hometown/entrypoint.sh.tmpl
knoflook 8e761a286d
Some checks failed
continuous-integration/drone/push Build is failing
chore: release 0.2.0+v3.5.5-hometown-1.0.8
2023-02-15 16:24:53 +01:00

33 lines
575 B
Bash

#!/bin/bash
set -eu
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"
}
export DB_PASS=$(cat /run/secrets/db_password)
{{ if eq (env "OIDC_ENABLED") "true" }}
file_env "OIDC_CLIENT_SECRET"
{{ end }}
/usr/bin/tini -s -- "$@"