Fix hardcoded paths for production environment
- Update get_work_path_default() to check for .env in /opt/gbo/bin/.env - Update get_stack_path() to check for .env in /opt/gbo/bin/.env - Update DriveMonitor::new() to use get_work_path() instead of hardcoded path - Update start_config_watcher() to use get_work_path() instead of hardcoded path This fixes the issue where botserver was using development paths (/home/rodriguez/src/gb/botserver-stack/data/system/work) in production instead of production paths (/opt/gbo/work).
This commit is contained in:
parent
8dcc6679bb
commit
f526fa1daa
3 changed files with 7 additions and 6 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ impl DriveMonitor {
|
|||
}
|
||||
|
||||
pub fn new(state: Arc<AppState>, 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()));
|
||||
|
||||
|
|
|
|||
|
|
@ -1092,9 +1092,10 @@ async fn start_local_file_monitor(app_state: Arc<AppState>) {
|
|||
|
||||
async fn start_config_watcher(app_state: Arc<AppState>) {
|
||||
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");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue