Configured
Opinionated utility to load a configuration from well defined layers into any type which can be deserialized by Serde using kebab-case.
First, values from the mandatory default configuration file at <CONFIG_DIR>/default.yaml are loaded.
Then, if the environment variable CONFIG_OVERLAYS is defined, its comma separated overlays (e.g. "prod" or "feat, dev") at <CONFIG_DIR>/<overlay>.yaml are loaded from left to right as overlays, i.e. adding or overwriting already existing values.
Finally environment variables prefixed with <CONFIG_ENV_PREFIX>__ and segments separated by __ (double underscores are used as segment separators to allow for single underscores in segment names) are used as final overlay.
Example
Attribution
This utility is built on top of the fantastic Config library.
License
This code is open source software licensed under the Apache 2.0 License.