fix: source ~/.env with set -a so variables are exported to child processes

Variables set in ~/.env without explicit export were shell-local only —
child processes (scripts, subshells) never inherited them. Source it in
a dedicated section with set -a/set +a to auto-export everything.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 18:28:46 +02:00
co-authored by Claude Sonnet 4.6
parent 3ef96ff8ab
commit eeed7f3566
+13 -1
View File
@@ -83,13 +83,25 @@ for expr in "${eval_expressions[@]}"; do
done done
# =============================================================================
# ENVIRONMENT VARIABLES
# =============================================================================
# Source ~/.env with set -a so every variable is automatically exported
# and inherited by child processes (scripts, subshells, etc.).
if [[ -f "$HOME/.env" && -r "$HOME/.env" ]]; then
set -a
source "$HOME/.env"
set +a
fi
# ============================================================================= # =============================================================================
# CONFIGURATION FILES TO SOURCE # CONFIGURATION FILES TO SOURCE
# ============================================================================= # =============================================================================
# Define files to source in an array for easy management # Define files to source in an array for easy management
source_files=( source_files=(
"$HOME/.env"
"$HOME/.nvm/nvm.sh" "$HOME/.nvm/nvm.sh"
"$HOME/.cargo/env" "$HOME/.cargo/env"
"$HOME/.oh-my-zsh/oh-my-zsh.sh" "$HOME/.oh-my-zsh/oh-my-zsh.sh"