fix: allow container install without Vault configured
All checks were successful
GBCI Bundle / build-bundle (push) Has been skipped
GBCI / build (push) Successful in 5m19s

- Make create_container_service work without DATABASE_URL from Vault
- Components like vault, vector_db that don't need DB can now install first
- DB_PASSWORD defaults to empty string when Vault is not available
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-12-19 09:33:56 -03:00
parent e3e24e514f
commit f4e0fc4f28

View file

@ -723,10 +723,20 @@ impl PackageManager {
exec_cmd: &str, exec_cmd: &str,
env_vars: &HashMap<String, String>, env_vars: &HashMap<String, String>,
) -> Result<()> { ) -> Result<()> {
let database_url = get_database_url_sync() // Try to get DB password from Vault, but don't fail if Vault isn't available yet
.context("Failed to get DATABASE_URL from Vault. Ensure Vault is configured.")?; // (e.g., when installing Vault itself or other components that don't need DB)
let (_db_username, db_password, _db_server, _db_port, _db_name) = let db_password = match get_database_url_sync() {
parse_database_url(&database_url); Ok(url) => {
let (_, password, _, _, _) = parse_database_url(&url);
password
}
Err(_) => {
trace!(
"Vault not available for DB_PASSWORD in container service, using empty string"
);
String::new()
}
};
let rendered_cmd = exec_cmd let rendered_cmd = exec_cmd
.replace("{{DB_PASSWORD}}", &db_password) .replace("{{DB_PASSWORD}}", &db_password)