diff --git a/src/core/shared/utils.rs b/src/core/shared/utils.rs index 96cd7f45..8b6e565e 100644 --- a/src/core/shared/utils.rs +++ b/src/core/shared/utils.rs @@ -113,7 +113,8 @@ pub fn get_work_path() -> String { /// In development (with botserver-stack directory): ./botserver-stack/data/system/work fn get_work_path_default() -> String { let has_stack = std::path::Path::new("./botserver-stack").exists(); - let has_env = std::path::Path::new("./.env").exists(); + let has_env = std::path::Path::new("./.env").exists() + || std::path::Path::new("/opt/gbo/bin/.env").exists(); if has_env && !has_stack { "/opt/gbo/work".to_string() } else { @@ -126,7 +127,8 @@ fn get_work_path_default() -> String { /// In development (with botserver-stack directory): ./botserver-stack pub fn get_stack_path() -> String { let has_stack = std::path::Path::new("./botserver-stack").exists(); - let has_env = std::path::Path::new("./.env").exists(); + let has_env = std::path::Path::new("./.env").exists() + || std::path::Path::new("/opt/gbo/bin/.env").exists(); if has_env && !has_stack { "/opt/gbo".to_string() } else { diff --git a/src/drive/drive_monitor/mod.rs b/src/drive/drive_monitor/mod.rs index 9fed4aa7..4104925b 100644 --- a/src/drive/drive_monitor/mod.rs +++ b/src/drive/drive_monitor/mod.rs @@ -57,9 +57,7 @@ impl DriveMonitor { } pub fn new(state: Arc, bucket_name: String, bot_id: uuid::Uuid) -> Self { - let work_root = std::env::current_dir() - .unwrap_or_else(|_| PathBuf::from(".")) - .join("botserver-stack/data/system/work"); + let work_root = PathBuf::from(crate::core::shared::utils::get_work_path()); #[cfg(any(feature = "research", feature = "llm"))] let kb_manager = Arc::new(KnowledgeBaseManager::new(work_root.clone())); diff --git a/src/main_module/bootstrap.rs b/src/main_module/bootstrap.rs index a90a56cd..7f8c8cfc 100644 --- a/src/main_module/bootstrap.rs +++ b/src/main_module/bootstrap.rs @@ -1092,9 +1092,10 @@ async fn start_local_file_monitor(app_state: Arc) { async fn start_config_watcher(app_state: Arc) { use crate::core::config::watcher::ConfigWatcher; + use crate::core::shared::utils::get_work_path; use std::sync::Arc as StdArc; - let data_dir = std::path::PathBuf::from("/home/rodriguez/src/gb/botserver-stack/data/system/work"); + let data_dir = std::path::PathBuf::from(get_work_path()); let watcher = ConfigWatcher::new(data_dir, app_state.clone()); let _handle = StdArc::new(watcher).spawn(); trace!("ConfigWatcher started - monitoring config.csv changes");