harden the config reader against an empty or malformed .env
holcommon's empty .env made the loader evaluate one blank line, which tripped set -u. Verified afterwards on holcommon's real host stack: the CLI and the make engine resolve the same five files and render a byte-identical 241-line compose config.
This commit is contained in:
@@ -36,7 +36,10 @@ myos_dotenv_parse() {
|
||||
myos_dotenv_load() {
|
||||
[ -f "$1" ] || return 0
|
||||
while IFS= read -r _kv; do
|
||||
# an empty file still yields one empty line through the here-document
|
||||
[ -n "$_kv" ] || continue
|
||||
_k=${_kv%%=*}
|
||||
[ -n "$_k" ] || continue
|
||||
[ -n "$(myos_var "$_k")" ] && continue
|
||||
eval "$_k=\${_kv#*=}"
|
||||
done <<EOF
|
||||
|
||||
Reference in New Issue
Block a user