Refactor secret generation script to improve variable management

- Moved the declaration of the generated_values associative array to a more appropriate location in 03_generate_secrets.sh for better organization.
- Removed redundant declaration of generated_values to streamline the script's logic and enhance readability.
This commit is contained in:
Yury Kossakovsky
2025-05-28 17:13:46 -06:00
parent 47cfef0698
commit 597d43ec3c

View File

@@ -53,6 +53,7 @@ declare -A VARS_TO_GENERATE=(
# Initialize existing_env_vars and attempt to read .env if it exists
log_info "Initializing environment configuration..."
declare -A existing_env_vars
declare -A generated_values
if [ -f "$OUTPUT_FILE" ]; then
log_info "Found existing $OUTPUT_FILE. Reading its values to use as defaults and preserve current settings."
@@ -325,9 +326,6 @@ if [ ! -f "$TEMPLATE_FILE" ]; then
exit 1
fi
# Associative array to store generated values
declare -A generated_values
# Pre-populate generated_values with non-empty values from existing_env_vars
for key_from_existing in "${!existing_env_vars[@]}"; do
if [[ -n "${existing_env_vars[$key_from_existing]}" ]]; then