fix: align apps:set/apps:report with what dokku actually reads
The apps plugin accepted `apps:set --global deploy-source` and `apps:set --global deploy-source-metadata` even though nothing reads those properties globally, accepted `apps:set <app> disable-autocreation` even though only the global form is consulted by `maybeCreateApp`, and never emitted `disable-autocreation` in `apps:report` for either scope. Drop the global `deploy-source*` writes from `GlobalProperties`, reject per-app `disable-autocreation` writes at the plugin level, and surface `--app-global-disable-autocreation` in both the per-app and `--global` reports so the property the runtime actually reads is round-trippable.
This commit is contained in:
@@ -10,8 +10,6 @@ var (
|
||||
|
||||
// GlobalProperties is a map of all valid global apps properties
|
||||
GlobalProperties = map[string]bool{
|
||||
"deploy-source": true,
|
||||
"deploy-source-metadata": true,
|
||||
"disable-autocreation": true,
|
||||
"disable-autocreation": true,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -17,14 +17,17 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{}
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--app-global-disable-autocreation": reportGlobalDisableAutocreation,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--app-created-at": reportCreatedAt,
|
||||
"--app-deploy-source": reportDeploySource,
|
||||
"--app-deploy-source-metadata": reportDeploySourceMetadata,
|
||||
"--app-dir": reportDir,
|
||||
"--app-locked": reportLocked,
|
||||
"--app-created-at": reportCreatedAt,
|
||||
"--app-deploy-source": reportDeploySource,
|
||||
"--app-deploy-source-metadata": reportDeploySourceMetadata,
|
||||
"--app-dir": reportDir,
|
||||
"--app-global-disable-autocreation": reportGlobalDisableAutocreation,
|
||||
"--app-locked": reportLocked,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +70,10 @@ func reportDir(appName string) string {
|
||||
return common.AppRoot(appName)
|
||||
}
|
||||
|
||||
func reportGlobalDisableAutocreation(appName string) string {
|
||||
return common.PropertyGet("apps", "--global", "disable-autocreation")
|
||||
}
|
||||
|
||||
func reportLocked(appName string) string {
|
||||
locked := "false"
|
||||
if appIsLocked(appName) {
|
||||
|
||||
@@ -228,6 +228,9 @@ func CommandReport(appName string, format string, infoFlag string) error {
|
||||
|
||||
// CommandSet set or clear an apps property for an app
|
||||
func CommandSet(appName string, property string, value string) error {
|
||||
if appName != "--global" && property == "disable-autocreation" {
|
||||
common.LogFail("Property can only be specified globally")
|
||||
}
|
||||
common.CommandPropertySet("apps", appName, property, value, DefaultProperties, GlobalProperties)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user