use config::Config;
lazy_static::lazy_static! {
#[derive(Debug)]
pub static ref CONFIG: Config = Config::builder()
.add_source(config::Environment::with_prefix("APP_NAME").separator("_"))
.build()
.unwrap();
}
pub fn get<'a, T: serde::Deserialize<'a>>(key: &str) -> T {
CONFIG.get::<T>(key).unwrap()
}
fn main() {
println!("{:?}", get::<String>("foo"));
}