feat: implement global support for setting proxy type

This commit is contained in:
Jose Diaz-Gonzalez
2024-01-19 04:13:55 -05:00
parent ea28367689
commit 7fbb86093b
6 changed files with 73 additions and 8 deletions

View File

@@ -79,16 +79,22 @@ func CommandReport(appName string, format string, infoFlag string) error {
// CommandSet sets a proxy for an app
func CommandSet(appName string, proxyType string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
if appName != "--global" {
if err := common.VerifyAppName(appName); err != nil {
return err
}
}
if len(proxyType) < 2 {
return errors.New("Please specify a proxy type")
}
key := "DOKKU_APP_PROXY_TYPE"
if appName == "--global" {
key = "DOKKU_PROXY_TYPE"
}
entries := map[string]string{
"DOKKU_APP_PROXY_TYPE": proxyType,
key: proxyType,
}
return config.SetMany(appName, entries, false)
}