Substitute environment variables in config.

This commit is contained in:
Orne Brocaar 2022-04-23 11:23:25 +01:00
parent c4e6e8f369
commit df155413d8

View File

@ -1,7 +1,7 @@
use std::fs;
use std::path::Path;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use std::{env, fs};
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
@ -540,6 +540,11 @@ pub fn load(config_dir: &Path) -> Result<()> {
}
}
// substitute environment variables in config file
for (k, v) in env::vars() {
content = content.replace(&format!("${}", k), &v);
}
let conf: Configuration = toml::from_str(&content)?;
set(conf);