Adds the missing raw/global/computed report keys for ten settable properties across the ps, builder, scheduler, proxy, openresty, nginx, and scheduler-k3s plugins so external tooling can verify drift through `:report --format json`. The scheduler-k3s `token` is masked as `*******` in default stdout output and only unmasked when the report is requested via `--format json` or when the flag is queried explicitly by name; the same explicit-query unmasking rule is extended to the existing traefik `dns-provider-<env_var>` keys.
105 lines
3.0 KiB
Go
105 lines
3.0 KiB
Go
package builder
|
|
|
|
import (
|
|
"github.com/dokku/dokku/plugins/common"
|
|
)
|
|
|
|
// ReportSingleApp is an internal function that displays the builder 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{
|
|
"--builder-global-selected": reportGlobalSelected,
|
|
"--builder-global-build-dir": reportGlobalBuildDir,
|
|
"--builder-global-skip-cleanup": reportGlobalSkipCleanup,
|
|
"--builder-computed-skip-cleanup": reportComputedSkipCleanup,
|
|
}
|
|
} else {
|
|
flags = map[string]common.ReportFunc{
|
|
"--builder-computed-selected": reportComputedSelected,
|
|
"--builder-global-selected": reportGlobalSelected,
|
|
"--builder-selected": reportSelected,
|
|
"--builder-detected": reportDetected,
|
|
"--builder-computed-build-dir": reportComputedBuildDir,
|
|
"--builder-global-build-dir": reportGlobalBuildDir,
|
|
"--builder-build-dir": reportBuildDir,
|
|
"--builder-computed-skip-cleanup": reportComputedSkipCleanup,
|
|
"--builder-global-skip-cleanup": reportGlobalSkipCleanup,
|
|
"--builder-skip-cleanup": reportSkipCleanup,
|
|
}
|
|
}
|
|
|
|
flagKeys := []string{}
|
|
for flagKey := range flags {
|
|
flagKeys = append(flagKeys, flagKey)
|
|
}
|
|
|
|
trimPrefix := false
|
|
uppercaseFirstCharacter := true
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
|
return common.ReportSingleApp("builder", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
|
}
|
|
|
|
func reportComputedSelected(appName string) string {
|
|
value := reportSelected(appName)
|
|
if value == "" {
|
|
value = reportGlobalSelected(appName)
|
|
}
|
|
|
|
return value
|
|
}
|
|
|
|
func reportGlobalSelected(appName string) string {
|
|
return common.PropertyGet("builder", "--global", "selected")
|
|
}
|
|
|
|
func reportDetected(appName string) string {
|
|
return common.PropertyGet("builder", appName, "detected")
|
|
}
|
|
|
|
func reportSelected(appName string) string {
|
|
return common.PropertyGet("builder", appName, "selected")
|
|
}
|
|
|
|
func reportComputedBuildDir(appName string) string {
|
|
value := reportBuildDir(appName)
|
|
if value == "" {
|
|
value = reportGlobalBuildDir(appName)
|
|
}
|
|
|
|
return value
|
|
}
|
|
func reportGlobalBuildDir(appName string) string {
|
|
return common.PropertyGet("builder", "--global", "build-dir")
|
|
}
|
|
|
|
func reportBuildDir(appName string) string {
|
|
return common.PropertyGet("builder", appName, "build-dir")
|
|
}
|
|
|
|
func reportComputedSkipCleanup(appName string) string {
|
|
value := reportSkipCleanup(appName)
|
|
if value == "" {
|
|
value = reportGlobalSkipCleanup(appName)
|
|
}
|
|
if value == "" {
|
|
value = "false"
|
|
}
|
|
|
|
return value
|
|
}
|
|
|
|
func reportGlobalSkipCleanup(appName string) string {
|
|
return common.PropertyGet("builder", "--global", "skip-cleanup")
|
|
}
|
|
|
|
func reportSkipCleanup(appName string) string {
|
|
return common.PropertyGet("builder", appName, "skip-cleanup")
|
|
}
|