From 163ab626cd2b8875161b2598e9400df201eacaa8 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 13 Nov 2024 09:24:53 +0800 Subject: [PATCH] feat: support env `_CONFIG_FILE` (#990) --- src/config/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 7c523c52..e6dd5c8c 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -361,7 +361,10 @@ impl Config { } pub fn agent_config_file(name: &str) -> PathBuf { - Self::agent_data_dir(name).join(CONFIG_FILE_NAME) + match env::var(format!("{}_CONFIG_FILE", normalize_env_name(name))) { + Ok(value) => PathBuf::from(value), + Err(_) => Self::agent_data_dir(name).join(CONFIG_FILE_NAME), + } } pub fn agent_rag_file(agent_name: &str, rag_name: &str) -> PathBuf {