Add logging of missing variables and trim keys in .env parsing

This commit is contained in:
Kelin
2026-02-02 13:56:27 -05:00
parent 80b44f8bef
commit cd9dc925f3

View File

@@ -77,14 +77,8 @@ load_env_file_safely() {
local key="${BASH_REMATCH[1]}" local key="${BASH_REMATCH[1]}"
local value="${BASH_REMATCH[2]}" local value="${BASH_REMATCH[2]}"
# Remove surrounding quotes if present # Trim whitespace from key and value
if [[ $value =~ ^\'(.*)\'$ ]]; then key=$(echo "$key" | xargs)
value="${BASH_REMATCH[1]}"
elif [[ $value =~ ^\"(.*)\"$ ]]; then
value="${BASH_REMATCH[1]}"
fi
# Trim whitespace from value
value=$(echo "$value" | xargs) value=$(echo "$value" | xargs)
debug_log "Exported $key=[HIDDEN]" # Don't log actual values for security debug_log "Exported $key=[HIDDEN]" # Don't log actual values for security
fi fi
@@ -619,6 +613,7 @@ validate_and_prompt_variables() {
esac esac
else else
echo "" echo ""
echo "Missing variables: ${missing_vars[*]}"
echo "Some variables need configuration. Press Enter to continue or 'q' to quit." echo "Some variables need configuration. Press Enter to continue or 'q' to quit."
read -p "Press Enter to configure missing variables, or 'q' to quit: " user_choice read -p "Press Enter to configure missing variables, or 'q' to quit: " user_choice