influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
29.08k stars 3.56k forks source link

Cannot load feature flag config values from a config file #23017

Open williamhbaker opened 2 years ago

williamhbaker commented 2 years ago

A config file like this:

{
    "feature-flags": {
        "newAutoRefresh": "false"
    }
}

or this:

[feature-flags]
  newAutoRefresh = "false"

or even this:

feature-flags:
    newAutoRefresh: "false"

Results in this error:

021-12-21T21:02:29.723346Z  info    Welcome to InfluxDB {"log_id": "0YZhgaLl000", "version": "dev", "commit": "ca0bec4768", "build_date": "2021-12-21T21:02:29Z"}
2021-12-21T21:02:29.723868Z debug   loaded config file  {"log_id": "0YZhgaLl000", "path": "/Users/wbaker/influxdb/cmd/influxd/config.json"}
2021-12-21T21:02:29.724136Z error   Failed to configure feature flag overrides  {"log_id": "0YZhgaLl000", "error": "configured overrides for non-existent flags: newautorefresh", "overrides": {"newautorefresh":"false"}}
Error: configured overrides for non-existent flags: newautorefresh
See 'influxd -h' for help
williamhbaker commented 2 years ago

Seems to stem from the fact that viper parses config values in a case-insensitive way (lowercase): https://github.com/spf13/viper/blob/65f16c17380edb084e5ccf131fa5598802a6bf68/README.md?plain=1#L82

The feature flag package is case sensitive though, and I suspect the UI is case sensitive as well.