Files
VictoriaMetrics/lib/envflag/secret.go
Max Kotliar 8dd905c7a9 lib/envflag: apply -secret.flags inside envflag.Parse function (2nd attempt) (#9963)
### Describe Your Changes

The PR https://github.com/VictoriaMetrics/VictoriaMetrics/pull/9942 was
reverted in
c90c7c3123
because of the import cycle in the enterprise VM. Needs more work.

### Checklist

The following checks are **mandatory**:

- [ ] My change adheres to [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/victoriametrics/contributing/#pull-request-checklist).
- [ ] My change adheres to [VictoriaMetrics development
goals](https://docs.victoriametrics.com/victoriametrics/goals/).
2025-11-12 19:23:51 +02:00

18 lines
646 B
Go

package envflag
import "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
// secretFlagsList contains names of flags with secret values obtained from
// the `-secret.flags` command-line option.
var secretFlagsList = flagutil.NewArrayString("secret.flags",
"Comma-separated list of flag names with secret values. Values for these flags are hidden in logs and on /metrics page")
// applySecretFlags registers flags from `-secret.flags` after they are parsed.
//
// The function must be called inside envflag.Parse after parsing flags.
func applySecretFlags() {
for _, f := range *secretFlagsList {
flagutil.RegisterSecretFlag(f)
}
}