Open farrago opened 3 years ago
Thanks for submitting the PR!
I really don't like that you need to have a configuration file even though all variables are supplied as envs.
Found this: https://github.com/joho/godotenv. Any obvious downsides going with this instead?
This initially replaces the manual conf.json file loading and parsing with viper. The same file is still loaded from the same location and fills the same configuration struct, so there are no backwards compatibility issues.
Using viper then adds the ability to override config settings with an environment variable in the form
"FEATMAP_<uppercase setting name>"
. e.g.FEATMAP_PORT=8080
would override theport
value inconf.json
.Due to the way Viper works, this cannot load from only env vars, so the config file is still needed and the env vars can only override it. See https://github.com/spf13/viper/issues/584
To help protect users from this issue, this change also adds verification that essential config settings have been configured.
Tests