fix: do not sanitize if the value was the one requested

This commit is contained in:
Jose Diaz-Gonzalez
2025-11-23 00:11:05 -05:00
parent f4e2c32721
commit e60ebf12fa

View File

@@ -14,6 +14,7 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
} }
os.Setenv("DOKKU_REPORT_FORMAT", format) os.Setenv("DOKKU_REPORT_FORMAT", format)
os.Setenv("DOKKU_REPORT_FLAG", infoFlag)
flags := map[string]common.ReportFunc{ flags := map[string]common.ReportFunc{
"--logs-computed-app-label-alias": reportComputedAppLabelAlias, "--logs-computed-app-label-alias": reportComputedAppLabelAlias,
"--logs-computed-max-size": reportComputedMaxSize, "--logs-computed-max-size": reportComputedMaxSize,
@@ -73,17 +74,25 @@ func reportVectorGlobalImage(appName string) string {
func reportGlobalVectorSink(appName string) string { func reportGlobalVectorSink(appName string) string {
value := common.PropertyGet("logs", "--global", "vector-sink") value := common.PropertyGet("logs", "--global", "vector-sink")
if value == "" {
return value
}
if os.Getenv("DOKKU_REPORT_FORMAT") != "stdout" {
return value
}
if os.Getenv("DOKKU_REPORT_FLAG") == "--logs-global-vector-sink" {
return value
}
// only show the schema and sanitize the rest // only show the schema and sanitize the rest
if value != "" && os.Getenv("DOKKU_REPORT_FORMAT") == "stdout" {
sink, err := SinkValueToConfig("--global", value) sink, err := SinkValueToConfig("--global", value)
if err != nil { if err != nil {
return "" return ""
} }
return fmt.Sprintf("%s://redacted", sink["type"]) return fmt.Sprintf("%s://redacted", sink["type"])
}
return ""
} }
func reportMaxSize(appName string) string { func reportMaxSize(appName string) string {
@@ -92,14 +101,23 @@ func reportMaxSize(appName string) string {
func reportVectorSink(appName string) string { func reportVectorSink(appName string) string {
value := common.PropertyGet("logs", appName, "vector-sink") value := common.PropertyGet("logs", appName, "vector-sink")
if value != "" && os.Getenv("DOKKU_REPORT_FORMAT") == "stdout" { if value == "" {
return value
}
if os.Getenv("DOKKU_REPORT_FORMAT") != "stdout" {
return value
}
if os.Getenv("DOKKU_REPORT_FLAG") == "--logs-vector-sink" {
return value
}
// only show the schema and sanitize the rest
sink, err := SinkValueToConfig(appName, value) sink, err := SinkValueToConfig(appName, value)
if err != nil { if err != nil {
return "" return ""
} }
return fmt.Sprintf("%s://redacted", sink["type"]) return fmt.Sprintf("%s://redacted", sink["type"])
}
return ""
} }