fix: Bootstrap checks stack/.env path in addition to ./.env
Some checks failed
BotServer CI/CD / build (push) Failing after 1m25s

- Production has .env in botserver-stack/.env not ./.env
- Checks both locations to detect completed bootstrap
- Prevents full re-bootstrap on restart in production
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-01 19:26:32 -03:00
parent 318367d439
commit 8fd3254334

View file

@ -88,13 +88,17 @@ pub async fn run_bootstrap(
trace!("Creating BootstrapManager..."); trace!("Creating BootstrapManager...");
let mut bootstrap = BootstrapManager::new(install_mode, tenant); let mut bootstrap = BootstrapManager::new(install_mode, tenant);
let stack_path = std::env::var("BOTSERVER_STACK_PATH")
.unwrap_or_else(|_| "./botserver-stack".to_string());
let env_path = std::path::Path::new("./.env"); let env_path = std::path::Path::new("./.env");
let vault_init_path = std::path::Path::new("./botserver-stack/conf/vault/init.json"); let stack_env_path = std::path::Path::new(&format!("{}/.env", stack_path));
let bootstrap_completed = env_path.exists() && vault_init_path.exists(); let vault_init_path = std::path::Path::new(&format!("{}/conf/vault/init.json", stack_path));
let bootstrap_completed = (env_path.exists() || stack_env_path.exists()) && vault_init_path.exists();
info!( info!(
"Bootstrap check: .env exists={}, init.json exists={}, bootstrap_completed={}", "Bootstrap check: .env exists={}, stack/.env exists={}, init.json exists={}, bootstrap_completed={}",
env_path.exists(), env_path.exists(),
stack_env_path.exists(),
vault_init_path.exists(), vault_init_path.exists(),
bootstrap_completed bootstrap_completed
); );