Configuration management


After a bit of derailing conversation on a PR.

We need to talk about this a bit on a forum.

About what takes precedence when multiple values are given. Essentially something more like how say the MySQL or PostgresSQL daemons behave.

Level zero: Code defaults (literals)

These are the hardcoded defaults in the code.

Level one: Environment variables

These can be set by package maintainers and only override the code defaults.

Level two: Base config file (XML/TOML/JSON/YAML etc)

This config file can be edited by hand, to override the defaults from level one and lower.

Level three: Main config file (XML/TOML/JSON/YAML etc)

This config file represents all values set in the UI that are different from the defaults (and different from the base). This way we keep the default properly in effect until someone changes them.

Level four: CLI arguments

These should be available for all main config options (probably the same list as the env vars). These are here so when someone runs the server is a certain test mode (think debug log mode or a different port, they can run it without it affecting their setting of their main (hopefully service) install. These will disable the editing of the passed values in the UI (for safety).