Strip carriage returns from .env values to handle DOS line endings

This commit is contained in:
Kelin
2026-02-02 14:48:28 -05:00
parent 10338f2de5
commit fd15c18389

View File

@@ -84,6 +84,9 @@ load_env_file_safely() {
key=$(echo "$key" | xargs) key=$(echo "$key" | xargs)
value=$(echo "$value" | xargs) value=$(echo "$value" | xargs)
# Strip carriage return if present (DOS line endings)
value=${value%$'\r'}
# Export the variable # Export the variable
export "$key"="$value" export "$key"="$value"
@@ -128,6 +131,7 @@ localize_yml_file() {
# Use envsubst to replace all ${VAR} with environment values # Use envsubst to replace all ${VAR} with environment values
if command -v envsubst >/dev/null 2>&1; then if command -v envsubst >/dev/null 2>&1; then
log_info "DEBUG: DEFAULT_EMAIL=$DEFAULT_EMAIL"
envsubst < "$file_path" > "$file_path.tmp" && mv "$file_path.tmp" "$file_path" envsubst < "$file_path" > "$file_path.tmp" && mv "$file_path.tmp" "$file_path"
debug_log "Replaced variables in $file_path using envsubst" debug_log "Replaced variables in $file_path using envsubst"
replaced_count=$(grep -o '\${[^}]*}' "$file_path" | wc -l) replaced_count=$(grep -o '\${[^}]*}' "$file_path" | wc -l)