From ad5079ef37497d914c538f7f0109b3acd536c738 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index b528114..1baf3e8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -230,7 +230,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