fix(env): load derived dotenv vars under nounset

This commit is contained in:
defiQUG
2026-03-29 18:41:15 -07:00
parent 59cdd5af60
commit a923d7b397
2 changed files with 18 additions and 1 deletions

View File

@@ -20,14 +20,26 @@ load_env() {
esac
done
if [ -f "$file" ]; then
local had_nounset=0
if [[ $- == *u* ]]; then
had_nounset=1
set +u
fi
# shellcheck disable=SC2046
set -a; . "$file"; set +a
(( had_nounset )) && set -u
fi
if [ -n "$profile" ]; then
local pf="${file}.${profile}"
if [ -f "$pf" ]; then
local had_nounset_profile=0
if [[ $- == *u* ]]; then
had_nounset_profile=1
set +u
fi
# shellcheck disable=SC2046
set -a; . "$pf"; set +a
(( had_nounset_profile )) && set -u
fi
fi
}