2020-12-29 23:56:10 -05:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/dokku/dokku/plugins/common"
|
|
|
|
|
)
|
|
|
|
|
|
2021-01-20 14:49:32 -05:00
|
|
|
// ReportSingleApp is an internal function that displays the proxy report for one or more apps
|
2021-02-01 22:23:05 -05:00
|
|
|
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
2020-12-29 23:56:10 -05:00
|
|
|
if err := common.VerifyAppName(appName); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flags := map[string]common.ReportFunc{
|
2024-01-19 04:13:55 -05:00
|
|
|
"--proxy-enabled": reportEnabled,
|
|
|
|
|
"--proxy-computed-type": reportComputedType,
|
|
|
|
|
"--proxy-global-type": reportGlobalType,
|
|
|
|
|
"--proxy-type": reportType,
|
2020-12-29 23:56:10 -05:00
|
|
|
}
|
|
|
|
|
|
2021-01-07 01:34:05 -05:00
|
|
|
flagKeys := []string{}
|
|
|
|
|
for flagKey := range flags {
|
|
|
|
|
flagKeys = append(flagKeys, flagKey)
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-29 23:56:10 -05:00
|
|
|
trimPrefix := false
|
|
|
|
|
uppercaseFirstCharacter := true
|
2020-12-30 00:37:43 -05:00
|
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
2021-02-01 22:23:05 -05:00
|
|
|
return common.ReportSingleApp("proxy", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
2020-12-29 23:56:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func reportEnabled(appName string) string {
|
|
|
|
|
proxyEnabled := "false"
|
|
|
|
|
if IsAppProxyEnabled(appName) {
|
|
|
|
|
proxyEnabled = "true"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return proxyEnabled
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-19 04:13:55 -05:00
|
|
|
func reportComputedType(appName string) string {
|
|
|
|
|
proxyType := getGlobalProxyType()
|
|
|
|
|
if proxyType == "" {
|
|
|
|
|
proxyType = getAppProxyType(appName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return proxyType
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func reportGlobalType(appName string) string {
|
|
|
|
|
return getGlobalProxyType()
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-29 23:56:10 -05:00
|
|
|
func reportType(appName string) string {
|
|
|
|
|
return getAppProxyType(appName)
|
|
|
|
|
}
|