From 249919cc839932db55a62c5ba5da3d5f93105748 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Fri, 6 Nov 2020 11:59:29 +0100 Subject: [PATCH] Fix copy/pasta error --- entrypoint.sh.tmpl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl index 9cb6525..43e9b3a 100644 --- a/entrypoint.sh.tmpl +++ b/entrypoint.sh.tmpl @@ -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" }