From 649343858d9cc0077dc6df810f3489ff5272ae95 Mon Sep 17 00:00:00 2001 From: Oliver Ni Date: Sun, 14 Jul 2024 13:23:40 -0400 Subject: [PATCH] Add customizing config path --- src/config.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index a25b5a1..9d5aeeb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -250,7 +250,10 @@ pub fn load(path: &str) -> Result { } pub static CONFIG: LazyLock = LazyLock::new(|| { - match load("config.json") { + let config_path = var("CONFIG"); + let config_path = config_path.as_deref().unwrap_or("config.json"); + + match load(config_path) { Ok(config) => config, Err(err) => { // Avoid panicking @@ -266,9 +269,12 @@ pub async fn watch_config_changes(reload_handle: reload::Handle