Fix copy/pasta error
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Luke Murphy 2020-11-06 11:59:29 +01:00
parent 07c785dc51
commit 249919cc83
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 4 additions and 3 deletions

View File

@ -3,6 +3,8 @@
set -eu
file_env() {
# 3wc: Load $VAR_FILE into $VAR - useful for secrets. See
# https://medium.com/@adrian.gheorghe.dev/using-docker-secrets-in-your-environment-variables-7a0609659aab
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
@ -11,13 +13,12 @@ file_env() {
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}" elif [ "${!fileVar:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}