fix: Bootstrap checks stack/.env path in addition to ./.env
All checks were successful
BotServer CI/CD / build (push) Successful in 4m39s
All checks were successful
BotServer CI/CD / build (push) Successful in 4m39s
- Production has .env in botserver-stack/.env not ./.env - Checks both locations to detect completed bootstrap - Fixes E0716: use let bindings for Path borrows
This commit is contained in:
parent
8fd3254334
commit
d098961142
1 changed files with 9 additions and 7 deletions
|
|
@ -91,16 +91,18 @@ pub async fn run_bootstrap(
|
||||||
let stack_path = std::env::var("BOTSERVER_STACK_PATH")
|
let stack_path = std::env::var("BOTSERVER_STACK_PATH")
|
||||||
.unwrap_or_else(|_| "./botserver-stack".to_string());
|
.unwrap_or_else(|_| "./botserver-stack".to_string());
|
||||||
let env_path = std::path::Path::new("./.env");
|
let env_path = std::path::Path::new("./.env");
|
||||||
let stack_env_path = std::path::Path::new(&format!("{}/.env", stack_path));
|
let stack_env_path_str = format!("{}/.env", stack_path);
|
||||||
let vault_init_path = std::path::Path::new(&format!("{}/conf/vault/init.json", stack_path));
|
let vault_init_path_str = format!("{}/conf/vault/init.json", stack_path);
|
||||||
let bootstrap_completed = (env_path.exists() || stack_env_path.exists()) && vault_init_path.exists();
|
let stack_env_path = std::path::Path::new(&stack_env_path_str);
|
||||||
|
let vault_init_path = std::path::Path::new(&vault_init_path_str);
|
||||||
|
let env_exists = env_path.exists();
|
||||||
|
let stack_env_exists = stack_env_path.exists();
|
||||||
|
let vault_init_exists = vault_init_path.exists();
|
||||||
|
let bootstrap_completed = (env_exists || stack_env_exists) && vault_init_exists;
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"Bootstrap check: .env exists={}, stack/.env exists={}, init.json exists={}, bootstrap_completed={}",
|
"Bootstrap check: .env exists={}, stack/.env exists={}, init.json exists={}, bootstrap_completed={}",
|
||||||
env_path.exists(),
|
env_exists, stack_env_exists, vault_init_exists, bootstrap_completed
|
||||||
stack_env_path.exists(),
|
|
||||||
vault_init_path.exists(),
|
|
||||||
bootstrap_completed
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let cfg = if bootstrap_completed {
|
let cfg = if bootstrap_completed {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue