A library and cli tool for "compiling" an ordered set of configuration files into a single, flattened representation suitable for exporting to environment variables.
The Twelve-Factor App concept has been around for a while now, and, while the section on configuration makes good recommendations about how a conforming app should load its configuration, it doesn't specify how those variables are set in the first place.
The intent of this tool is to allow for defining configuration values in a more human-manageable format, then enabling the export of those values as environment variables.
Specific READMEs:
# given a file, config.yaml
foo:
bar: 10
baz: false
hoof: https://some.url
$ confpiler build config.yaml
FOO__BAR="10"
FOO__BAZ="false"
HOOF="https://some.url"
Given some files like the following:
somedir/
global.yaml
myapp/
default.yaml
development.yaml
production.yaml
staging.yaml
We can compile to a single representation of the "production" configuration with
$ cd somedir
$ confpiler build global.yaml myapp --env production --json
Which would yield a dictionary in JSON form representing merging global.yaml
,
myapp/default.yaml
and myapp/production.yaml
.
Currently the cli tool requires a "default" file when processing a directory.
See the library README
The following formats are currently supported:
- JOSN
- TOML
- YAML
- INI