diff --git a/src/config.rs b/src/config.rs index 5198719..b483c54 100644 --- a/src/config.rs +++ b/src/config.rs @@ -31,7 +31,14 @@ fn get_db_uri() -> String { } 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); // Read the JSON contents of the file as an instance of `User`.