Envconfig
Build a config structure form environment variables in Rust without boilerplate.
Usage
Let's say you application relies on the following environment variables:
DB_HOST
DB_PORT
And you want to initialize Config
structure like this one:
You can achieve this with the following code without boilerplate:
extern crate envconfig_derive;
extern crate envconfig;
// Initialize config from environment variables or terminate the process.
let config = init.unwrap_or_else;
Running tests
Tests do some manipulation with environment variables, so to prevent flaky tests they have to be executed in a single thread:
cargo test -- --test-threads=1
License
Contributors
- greyblake Potapov Sergey - creator, maintainer.