cape icon indicating copy to clipboard operation
cape copied to clipboard

Conventions for configuration

Open pictographer opened this issue 2 years ago • 3 comments

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

See Meeting Notes from Feb 25, 2022

pictographer avatar Feb 25 '22 18:02 pictographer

This is somewhat related to the page @sveitser created this morning: https://www.notion.so/translucence/CAPE-Demo-configuration-820caf91aa8b4890a6b0b5310947027b

nyospe avatar Feb 25 '22 18:02 nyospe

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

VictorKoenders avatar Mar 04 '22 18:03 VictorKoenders

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 " created, please edit this an re-run this program"

VictorKoenders avatar Mar 04 '22 18:03 VictorKoenders