fix(env): load derived dotenv vars under nounset
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user