mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/envflag: use flag.Set for setting the flags from env vars
This should make visible the set flags at flag.Visit(), which is used later for logging and exporting the `is_set` label for these flags at /metrics page
This commit is contained in:
parent
53bb58ed2a
commit
676ad70d9f
1 changed files with 1 additions and 1 deletions
|
@ -40,7 +40,7 @@ func Parse() {
|
||||||
// Get flag value from environment var.
|
// Get flag value from environment var.
|
||||||
fname := getEnvFlagName(f.Name)
|
fname := getEnvFlagName(f.Name)
|
||||||
if v, ok := os.LookupEnv(fname); ok {
|
if v, ok := os.LookupEnv(fname); ok {
|
||||||
if err := f.Value.Set(v); err != nil {
|
if err := flag.Set(f.Name, v); err != nil {
|
||||||
// Do not use lib/logger here, since it is uninitialized yet.
|
// Do not use lib/logger here, since it is uninitialized yet.
|
||||||
log.Fatalf("cannot set flag %s to %q, which is read from environment variable %q: %s", f.Name, v, fname, err)
|
log.Fatalf("cannot set flag %s to %q, which is read from environment variable %q: %s", f.Name, v, fname, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue