Skip to content

a configuration "compiler"

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

mattcl/confpiler

Repository files navigation

Confpiler

Build docs.rs (lib) Crates.io (lib) Crates.io (cli)

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:

CLI

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

Library

See the library README

Supported formats

The following formats are currently supported:

  • JOSN
  • TOML
  • YAML
  • INI

About

a configuration "compiler"

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published