name: configuration description: Guidelines for consuming and storing configuration.
Configuration
Name configuration
Configuration should, as a rule, nest objects rather than use underscores. For example, given the configuration that sets where "state" is stored, it should be something like:
state:
redis:
address: "..."
password: "..."
database: "..."
Try and avoid underscores (e.g. use "redis.address" and not "redis_address")
Consume Configuration
Configuration parameters should be accessible via:
- Command Line Flag: Use dot notation to match file structure (e.g.,
--slack.api.key="abcde"). - Environment Variable: With a prefix (e.g.,
ANNOUNCE_SLACK_API_KEY="abcde"). - File: See below.
Use spf13/viper for implementation.
Store Configuration Files
Store configuration in a path that follows the XDG standards. Use ardg/xdg for finding or writing to those files.