Crates.io | confpiler |
lib.rs | confpiler |
version | 0.2.2 |
source | src |
created_at | 2022-03-06 03:59:02.761794 |
updated_at | 2022-04-21 18:10:40.954446 |
description | A configuration "compiler" to aid in turning configuration file(s) into environment variables. |
homepage | https://github.com/mattcl/confpiler |
repository | https://github.com/mattcl/confpiler |
max_upload_size | |
id | 544362 |
size | 52,259 |
This crate provides a mechanism for "compiling" an ordered set of configuration files into a single, flattened representation suitable for exporting to environment variables.
Transforming
## default.yaml
foo:
bar: 10
baz: false
hoof: doof
## production.yaml
foo:
baz: true
into something like
"FOO__BAR": "10"
"FOO__BAZ": "false"
"HOOF": "doof"
via
use confpiler::FlatConfig;
let (conf, warnings) = FlatConfig::builder()
.add_config("foo/default")
.add_config("foo/production")
.build()
.expect("invalid config");
All values are converted to strings, with simple arrays being collapsed to
delimited strings (with the default separator being ,
).
This does not support arrays containing more complex values like other arrays and maps.