mirror of
https://github.com/dokku/dokku.git
synced 2026-07-11 13:01:51 +02:00
Every `:report` subcommand now recognizes `--global` as a scope selector that limits the report to globally-configured properties, including in JSON form via `--global --format json`. Previously this combination was rejected because `--global` was treated as an info flag, conflicting with `--format`. The shared `common.ParseReportArgs` helper now returns a `ReportArgs` struct exposing the parsed scope; each Go and bash report selects a global-only flag map when scope is global, and skips per-app verification.
65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
package proxy
|
|
|
|
import (
|
|
"github.com/dokku/dokku/plugins/common"
|
|
)
|
|
|
|
// ReportSingleApp is an internal function that displays the proxy report for one or more apps
|
|
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
|
if appName != "--global" {
|
|
if err := common.VerifyAppName(appName); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
var flags map[string]common.ReportFunc
|
|
if appName == "--global" {
|
|
flags = map[string]common.ReportFunc{
|
|
"--proxy-global-type": reportGlobalType,
|
|
}
|
|
} else {
|
|
flags = map[string]common.ReportFunc{
|
|
"--proxy-enabled": reportEnabled,
|
|
"--proxy-computed-type": reportComputedType,
|
|
"--proxy-global-type": reportGlobalType,
|
|
"--proxy-type": reportType,
|
|
}
|
|
}
|
|
|
|
flagKeys := []string{}
|
|
for flagKey := range flags {
|
|
flagKeys = append(flagKeys, flagKey)
|
|
}
|
|
|
|
trimPrefix := false
|
|
uppercaseFirstCharacter := true
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
|
return common.ReportSingleApp("proxy", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
|
}
|
|
|
|
func reportEnabled(appName string) string {
|
|
proxyEnabled := "false"
|
|
if IsAppProxyEnabled(appName) {
|
|
proxyEnabled = "true"
|
|
}
|
|
|
|
return proxyEnabled
|
|
}
|
|
|
|
func reportComputedType(appName string) string {
|
|
proxyType := getGlobalProxyType()
|
|
if proxyType == "" {
|
|
proxyType = getAppProxyType(appName)
|
|
}
|
|
|
|
return proxyType
|
|
}
|
|
|
|
func reportGlobalType(appName string) string {
|
|
return getGlobalProxyType()
|
|
}
|
|
|
|
func reportType(appName string) string {
|
|
return getAppProxyType(appName)
|
|
}
|