Simplify config handling in main()

  • Remove intermediate global variables for flags; deserialize straight into a config struct
  • Handle missing config file the same way as an empty config file
  • Eliminate global variables except those set at build time (main.Version, main.BuildTime)
  • Add tests for flags and the way flags + config file get merged
  • Refuse to boot if there are non-flag arguments because this is a common failure mode

This is a relatively risky change because it moves around almost all the config flags. However, the current situation is so mistake-prone that I think it is worth it to clean this up.

Example mistakes:

Edited by Jacob Vosmaer

Merge request reports

Loading