From eeed7f356602bf7a0aa02ae02ae71836bff6c990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Mon, 22 Jun 2026 18:28:46 +0200 Subject: [PATCH] fix: source ~/.env with set -a so variables are exported to child processes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .zshrc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 8d620b7..77b5f43 100644 --- a/.zshrc +++ b/.zshrc @@ -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"