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 authored and GitHub committed 2022-07-30 00:49:28 -04:00
commit 16090e58c7
2 files changed
+13 -1

No files matched your search

+8 -1
View File
@@ -172,7 +172,14 @@ func DockerCleanup(appName string, forceCleanup bool) error {
if !forceCleanup { if !forceCleanup {
skipCleanup := false skipCleanup := false
if appName != "" { 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[:])) output := strings.TrimSpace(string(b[:]))
if output == "true" { if output == "true" {
skipCleanup = true skipCleanup = true
+5
View File
@@ -14,6 +14,7 @@ import (
func main() { func main() {
parts := strings.Split(os.Args[0], "/") parts := strings.Split(os.Args[0], "/")
trigger := parts[len(parts)-1] trigger := parts[len(parts)-1]
global := flag.Bool("global", false, "--global: Whether global or app-specific")
flag.Parse() flag.Parse()
var err error var err error
@@ -27,6 +28,10 @@ func main() {
case "config-get": case "config-get":
appName := flag.Arg(0) appName := flag.Arg(0)
key := flag.Arg(1) key := flag.Arg(1)
if *global {
appName = "--global"
key = flag.Arg(0)
}
err = config.TriggerConfigGet(appName, key) err = config.TriggerConfigGet(appName, key)
case "config-get-global": case "config-get-global":
key := flag.Arg(0) key := flag.Arg(0)