fix: expose remaining settable properties via :report
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.
This commit is contained in:
@@ -7,6 +7,9 @@ import (
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
// tokenMask is shown in place of the raw token value in default stdout output.
|
||||
const tokenMask = "*******"
|
||||
|
||||
// ReportSingleApp is an internal function that displays the scheduler-k3s report for one or more apps
|
||||
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
if appName != "--global" {
|
||||
@@ -17,6 +20,12 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
tokenFlag := "--scheduler-k3s-global-token"
|
||||
tokenReportFunc := reportMaskedGlobalToken
|
||||
if format == "json" || infoFlag == tokenFlag {
|
||||
tokenReportFunc = reportGlobalToken
|
||||
}
|
||||
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--scheduler-k3s-computed-deploy-timeout": reportComputedDeployTimeout,
|
||||
"--scheduler-k3s-global-deploy-timeout": reportGlobalDeployTimeout,
|
||||
@@ -44,6 +53,7 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
"--scheduler-k3s-global-rollback-on-failure": reportGlobalRollbackOnFailure,
|
||||
"--scheduler-k3s-computed-shm-size": reportComputedShmSize,
|
||||
"--scheduler-k3s-global-shm-size": reportGlobalShmSize,
|
||||
tokenFlag: tokenReportFunc,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
@@ -267,3 +277,15 @@ func reportGlobalShmSize(appName string) string {
|
||||
func reportShmSize(appName string) string {
|
||||
return getShmSize(appName)
|
||||
}
|
||||
|
||||
func reportGlobalToken(appName string) string {
|
||||
return getGlobalGlobalToken()
|
||||
}
|
||||
|
||||
func reportMaskedGlobalToken(appName string) string {
|
||||
value := getGlobalGlobalToken()
|
||||
if value == "" {
|
||||
return ""
|
||||
}
|
||||
return tokenMask
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user