Open
Description
extern crate config;
use std::collections::HashMap;
fn main() {
let mut settings = config::Config::default();
let file = config::File::with_name("bla");
{
let result = settings.merge(file);
match result {
Ok(_) => (),
Err(e) => {
println!("{:?}",e);
println!("Failed to read the settings file, skipping...");
}
}
}
settings.merge(config::Environment::with_prefix("bla")).unwrap();
println!("{:?}", settings.try_into::<HashMap<String, String>>().unwrap());
}
The Environment::with_prefix
unwrap panics. Why does it? Output:
configuration file "bla" not found
Failed to read the settings file, skipping...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: configuration file "bla" not found', src\libcore\result.rs:906:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: process didn't exit successfully: `target\debug\vault-unseal.exe` (exit code: 101)