summaryrefslogtreecommitdiffstats
path: root/examples/simple/src/main.rs
blob: debad02d45be01c6b3630e704e69fd8a622384a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate config;

use std::collections::HashMap;

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

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