Skip to content

Commit

Permalink
Fix wrong evaluation of env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Holger Lösken committed Jun 8, 2020
1 parent 14c0fd8 commit 8516144
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,9 @@ in_error() {
exit 1
}

# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this clunkiness here.
# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this "magic" here.
ie_gv() {
local line name value
set | \
while read line; do
name=${line%=*} value=${line#*=\'}
if [ "$name" = "$1" ]; then
echo ${value%\'}
fi
done
eval "echo \$$1"
}

# usage: file_env VAR [DEFAULT]
Expand All @@ -37,7 +30,7 @@ file_env() {
in_error "Both $var and $fileVar are set (but are exclusive)"
fi

local val="$def"
local val="$def"
if [ "$(ie_gv ${var})" != "" ]; then
val=$(ie_gv ${var})
elif [ "$(ie_gv ${fileVar})" != "" ]; then
Expand Down

0 comments on commit 8516144

Please sign in to comment.