12 releases

0.5.0 Jun 14, 2023
0.4.3 Apr 21, 2022
0.3.4 Apr 11, 2022
0.3.0 Mar 31, 2022
0.1.0 Mar 6, 2022

#543 in Configuration

Download history 32/week @ 2024-02-22 7/week @ 2024-02-29 10/week @ 2024-03-07 3/week @ 2024-03-14

52 downloads per month

MIT/Apache and GPL-3.0-only

53KB
780 lines

Confpiler (cli)

This cli tool is intended to "compile" an ordered set of configuration files into a single, flattened representation suitable for exporting to environment variables.

For a complete list of subcommands/option (and more detailed help), see the relevant --help section.

A simple example:

# 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"

A more complicated example

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 this tool requires a "default" file when processing a directory.

Checking

Substituting check for build will just verify whether or not the configuration could be made given the options specified.

$ confpiler check global.yaml myapp --env staging

# or stricter
$ confpiler check global.yaml myapp --env staging --strict

Supported formats

The following formats are currently supported:

  • JOSN
  • TOML
  • YAML
  • INI

Dependencies

~17–34MB
~539K SLoC