cape
cape copied to clipboard
Conventions for configuration
For executables that read files or provide server interfaces, we should have consistent options for specifying file locations and network addresses, etc.
Configuration comes from several sources
- Command line arguments
- Environment variables
- Local configuration files
- Default or global configuration files
- Default configuration within the executable
We should agree on the priority ordering of the above.
Each configuration item should have a unique name, description, and meaning that is used across all our executables.
Configuration parameters used by more than one application include
- Base URL, e.g. https://localhost:420001/v1
- PORT environment variable - Note, base URL can include the port
- File system location for api.toml - Note, for containers, any configuration that differs per instance is inconvenient to set via files. Environment variables are preferred.
@Ancient123, @sveitser, @nyospe, @shenkeyao, @jbearer, @tri-joe, @philippecamacho
This is somewhat related to the page @sveitser created this morning: https://www.notion.so/translucence/CAPE-Demo-configuration-820caf91aa8b4890a6b0b5310947027b
Maybe also useful to decide on standards for:
- location of data/database files
- Log output
On unix system we might also have to differentiate between running our binaries as root and non-root users
For my personal projects I like to check the following paths:
- If running as
root
:/etc/<project>.toml
- Otherwise
./config.toml
If this folder doesn't exist, I create it with a default_config.toml
example, then print a message along the lines of "