diff --git a/src/data/config.rs b/src/data/config.rs index ab6d21f..a4f5c78 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -60,7 +60,7 @@ static mut CONF: Option = None; impl Config { fn yaml_str(parsed: &Yaml, name: &str) -> String { - match &parsed[name] { + let val = match &parsed[name] { Yaml::Real(r) | Yaml::String(r) => r.to_string(), Yaml::Integer(i) => i.to_string(), Yaml::Boolean(true) => "true".to_string(), @@ -71,7 +71,14 @@ impl Config { Yaml::BadValue => { panic!("{} is missing", name); } - }.to_string() + }.to_string(); + + // Check if we have to get an environment variable + if val.starts_with("$") { + std::env::var(&val[1..]).unwrap() + } else { + val + } } fn yaml_u64(parsed: &Yaml, name: &str) -> u64 {