fix: template secret, skip _FILE dance

This commit is contained in:
cellarspoon
2021-12-12 23:25:42 +01:00
parent b2a29da9a3
commit a5f9105613
3 changed files with 12 additions and 59 deletions

View File

@ -1,29 +1,3 @@
#!/bin/bash
set -e
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
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="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env "POSTGRES_DB_PASSWORD"
/start.py