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:
- !565 (merged) Priority 1
- !615 (comment 426214190) caught during development but confusing
Edited by Jacob Vosmaer