mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-02-21 01:21:21 +00:00
Substitute environment variables in config.
This commit is contained in:
parent
c4e6e8f369
commit
df155413d8
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user