Merge pull request #5272 from dokku/5269-global-config-trigger-flag

Add support for --global as app name when calling config-get trigger
This commit is contained in:
Jose Diaz-Gonzalez
2022-07-30 00:49:28 -04:00
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@@ -172,7 +172,14 @@ func DockerCleanup(appName string, forceCleanup bool) error {
if !forceCleanup {
skipCleanup := false
if appName != "" {
b, _ := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_SKIP_CLEANUP"}...)
triggerName := "config-get"
triggerArgs := []string{appName, "DOKKU_SKIP_CLEANUP"}
if appName == "--global" {
triggerName = "config-get-global"
triggerArgs = []string{"DOKKU_SKIP_CLEANUP"}
}
b, _ := PlugnTriggerOutput(triggerName, triggerArgs...)
output := strings.TrimSpace(string(b[:]))
if output == "true" {
skipCleanup = true

View File

@@ -14,6 +14,7 @@ import (
func main() {
parts := strings.Split(os.Args[0], "/")
trigger := parts[len(parts)-1]
global := flag.Bool("global", false, "--global: Whether global or app-specific")
flag.Parse()
var err error
@@ -27,6 +28,10 @@ func main() {
case "config-get":
appName := flag.Arg(0)
key := flag.Arg(1)
if *global {
appName = "--global"
key = flag.Arg(0)
}
err = config.TriggerConfigGet(appName, key)
case "config-get-global":
key := flag.Arg(0)