diff --git a/plugins/common/properties.go b/plugins/common/properties.go index c3b8a748b..fa17f40f4 100644 --- a/plugins/common/properties.go +++ b/plugins/common/properties.go @@ -12,9 +12,14 @@ import ( ) // CommandPropertySet is a generic function that will set a property for a given plugin/app combination -func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string) { - if err := VerifyAppName(appName); err != nil { - LogFail(err.Error()) +func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string, globalProperties map[string]bool) { + if appName != "--global" { + if err := VerifyAppName(appName); err != nil { + LogFail(err.Error()) + } + } + if !globalProperties[property] { + LogFail("Property cannot be specified globally") } if property == "" { LogFail("No property specified") diff --git a/plugins/logs/logs.go b/plugins/logs/logs.go index b343a8846..2ad2a1cec 100644 --- a/plugins/logs/logs.go +++ b/plugins/logs/logs.go @@ -11,6 +11,9 @@ var ( DefaultProperties = map[string]string{ "vector-sink": "", } + + // GlobalProperties is a map of all valid global logs properties + GlobalProperties = map[string]bool{} ) const VectorImage = "timberio/vector:0.11.X-debian" diff --git a/plugins/logs/subcommands.go b/plugins/logs/subcommands.go index ffabc7be9..ba59c17ff 100644 --- a/plugins/logs/subcommands.go +++ b/plugins/logs/subcommands.go @@ -75,7 +75,7 @@ func CommandSet(appName string, property string, value string) error { } } - common.CommandPropertySet("logs", appName, property, value, DefaultProperties) + common.CommandPropertySet("logs", appName, property, value, DefaultProperties, GlobalProperties) if property == "vector-sink" { common.LogVerboseQuiet(fmt.Sprintf("Writing updated vector config to %s", filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "logs", "vector.json"))) return writeVectorConfig() diff --git a/plugins/network/network.go b/plugins/network/network.go index e2f36ac47..954083f1e 100644 --- a/plugins/network/network.go +++ b/plugins/network/network.go @@ -22,6 +22,9 @@ var ( "attach-post-deploy": "", "tld": "", } + + // GlobalProperties is a map of all valid global network properties + GlobalProperties = map[string]bool{} ) // BuildConfig builds network config files diff --git a/plugins/network/subcommands.go b/plugins/network/subcommands.go index 5cf6e4d16..028ae0d9c 100644 --- a/plugins/network/subcommands.go +++ b/plugins/network/subcommands.go @@ -169,6 +169,6 @@ func CommandSet(appName string, property string, value string) error { } } - common.CommandPropertySet("network", appName, property, value, DefaultProperties) + common.CommandPropertySet("network", appName, property, value, DefaultProperties, GlobalProperties) return nil } diff --git a/plugins/ps/ps.go b/plugins/ps/ps.go index 84fc40996..7ca3dc5de 100644 --- a/plugins/ps/ps.go +++ b/plugins/ps/ps.go @@ -16,6 +16,9 @@ var ( DefaultProperties = map[string]string{ "restart-policy": "on-failure:10", } + + // GlobalProperties is a map of all valid global ps properties + GlobalProperties = map[string]bool{} ) // Rebuild rebuilds app from base image diff --git a/plugins/ps/subcommands.go b/plugins/ps/subcommands.go index dec35936a..008ca6201 100644 --- a/plugins/ps/subcommands.go +++ b/plugins/ps/subcommands.go @@ -163,7 +163,7 @@ func CommandSet(appName string, property string, value string) error { return dockeroptions.SetDockerOptionForPhases(appName, []string{"deploy"}, "restart", value) } - common.CommandPropertySet("ps", appName, property, value, DefaultProperties) + common.CommandPropertySet("ps", appName, property, value, DefaultProperties, GlobalProperties) return nil }