We should create a single source of truth config struct with sensible defaults and name convention, easy to extension in the future without breaking changes.
Options i have in mind.
- One monolithic config
One Toml, JSON or even XML config file with the ability to configure what file to load when starting the service using a flag like --config/c.
If we go with JSON i prefer if we support JSON5 because of the ability to add comments.
- Pros: Simple. easy to move.
- Cons: Big struct? too verbose.
- One config per module.
For example: storage.json, turn.json etc
It'll maybe make more sense when we make the plugin system and attachable modules.
- Pros: Ownership & cohesion
- Cons: More verbose and more complex for the end user.
- Optional: the ability to overwrite configs via arguments or env vars
- Pros: It will provide sensible deployment in some situation.
- Cons: Even more complex logic, harder to translate nested options and some types.
(we're open to any other option)
I think:
- We shouldn't store any secrets in the config file one way or another.
- We shouldn't tolerate incorrect or invalid config, it should fail fast, if the user types incorrect config key it should try to find the correct one and suggest it.
- If we support overriding configs via env, we should add a prefix to all the configurations ION_ so it doesn't cause conflations with other applications in weird setups.
- We should design the config in a way that it's possible to be over-ridable while the application is running or maybe even fully provided through the wire / external API. I don't think we should support that now, but we should design it in a way that this is possible.
Tasks:
We should create a single source of truth config struct with sensible defaults and name convention, easy to extension in the future without breaking changes.
Options i have in mind.
One Toml, JSON or even XML config file with the ability to configure what file to load when starting the service using a flag like
--config/c.If we go with JSON i prefer if we support JSON5 because of the ability to add comments.
For example: storage.json, turn.json etc
It'll maybe make more sense when we make the plugin system and attachable modules.
(we're open to any other option)
I think:
Tasks: