metrics: actually read flag value
This commit is contained in:
parent
1635da8021
commit
4abf2e5afd
|
@ -56,11 +56,16 @@ func init() {
|
||||||
// Now visit the flags we defined which are present in the args and see if we
|
// Now visit the flags we defined which are present in the args and see if we
|
||||||
// should enable metrics.
|
// should enable metrics.
|
||||||
fs.Visit(func(f *flag.Flag) {
|
fs.Visit(func(f *flag.Flag) {
|
||||||
|
g, ok := f.Value.(flag.Getter)
|
||||||
|
if !ok {
|
||||||
|
// Don't expect this to fail, but skip over just in case it does.
|
||||||
|
return
|
||||||
|
}
|
||||||
switch f.Name {
|
switch f.Name {
|
||||||
case "metrics":
|
case "metrics":
|
||||||
Enabled = true
|
Enabled = g.Get().(bool)
|
||||||
case "config":
|
case "config":
|
||||||
data, err := os.ReadFile(f.Value.String())
|
data, err := os.ReadFile(g.Get().(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue