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:
@@ -83,13 +83,25 @@ for expr in "${eval_expressions[@]}"; do
|
||||
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
|
||||
# =============================================================================
|
||||
|
||||
# Define files to source in an array for easy management
|
||||
source_files=(
|
||||
"$HOME/.env"
|
||||
"$HOME/.nvm/nvm.sh"
|
||||
"$HOME/.cargo/env"
|
||||
"$HOME/.oh-my-zsh/oh-my-zsh.sh"
|
||||
|
||||
Reference in New Issue
Block a user