fix: split report global keys into raw and computed across plugins
The `<plugin>-global-<property>` keys in `:report` output returned the resolved value with the built-in default substituted in, so external tooling could not distinguish a property that had been set globally to the default from one that had never been set. The bare keys for caddy, haproxy, and traefik global-only properties had the same shape. The `global-<property>` keys now hold the raw stored value and are empty when nothing has been set, and a new `computed-<property>` key holds the effective value used at runtime, falling back through the per-app value (where one exists), the global value, and the built-in default. The bare global-only keys for the three proxy plugins are removed in favor of the raw/computed pair. Closes #8631.
This commit is contained in:
@@ -17,11 +17,12 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--network-global-attach-post-create": reportGlobalAttachPostCreate,
|
||||
"--network-global-attach-post-deploy": reportGlobalAttachPostDeploy,
|
||||
"--network-global-bind-all-interfaces": reportGlobalBindAllInterfaces,
|
||||
"--network-global-initial-network": reportGlobalInitialNetwork,
|
||||
"--network-global-tld": reportGlobalTld,
|
||||
"--network-computed-bind-all-interfaces": reportComputedBindAllInterfaces,
|
||||
"--network-global-attach-post-create": reportGlobalAttachPostCreate,
|
||||
"--network-global-attach-post-deploy": reportGlobalAttachPostDeploy,
|
||||
"--network-global-bind-all-interfaces": reportGlobalBindAllInterfaces,
|
||||
"--network-global-initial-network": reportGlobalInitialNetwork,
|
||||
"--network-global-tld": reportGlobalTld,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
@@ -91,6 +92,9 @@ func reportComputedBindAllInterfaces(appName string) string {
|
||||
if value == "" {
|
||||
value = reportGlobalBindAllInterfaces(appName)
|
||||
}
|
||||
if value == "" {
|
||||
value = "false"
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
@@ -122,7 +126,7 @@ func reportGlobalAttachPostDeploy(appName string) string {
|
||||
}
|
||||
|
||||
func reportGlobalBindAllInterfaces(appName string) string {
|
||||
return common.PropertyGetDefault("network", "--global", "bind-all-interfaces", "false")
|
||||
return common.PropertyGet("network", "--global", "bind-all-interfaces")
|
||||
}
|
||||
|
||||
func reportGlobalInitialNetwork(appName string) string {
|
||||
|
||||
Reference in New Issue
Block a user