allow specifying config path via env var
All checks were successful
/ build-container (push) Successful in 5m33s
All checks were successful
/ build-container (push) Successful in 5m33s
This commit is contained in:
parent
d03734892d
commit
abfb37e88d
1 changed files with 8 additions and 1 deletions
|
@ -31,7 +31,14 @@ fn get_db_uri() -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn read_config() -> Config {
|
pub(crate) async fn read_config() -> Config {
|
||||||
let file = File::open("config.json").expect("failed to read config.json");
|
let filename = match std::env::var("CONFIG_PATH") {
|
||||||
|
Ok(value) => value,
|
||||||
|
Err(_) => "config.json".to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
|
log::info!("loading config file from {}", filename);
|
||||||
|
|
||||||
|
let file = File::open(filename).expect("failed to read config file");
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
|
|
||||||
// Read the JSON contents of the file as an instance of `User`.
|
// Read the JSON contents of the file as an instance of `User`.
|
||||||
|
|
Loading…
Reference in a new issue