config 0.15.22

Layered configuration system for Rust applications.
Documentation
use std::collections::HashMap;

use config::Config;

fn main() {
    let settings = Config::builder()
        // Add in `./settings.toml`
        .add_source(config::File::with_name("examples/settings"))
        // Add in settings from the environment (with a prefix of APP)
        // Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key
        .add_source(config::Environment::with_prefix("APP"))
        .build()
        .unwrap();

    // Print out our settings (as a HashMap)
    println!(
        "{:?}",
        settings
            .try_deserialize::<HashMap<String, String>>()
            .unwrap()
    );
}