fix: first run at secrets

See coop-cloud/outline#2.
This commit is contained in:
2022-01-05 18:38:43 +01:00
parent 84d65ce5f2
commit cb4fe2e91b
4 changed files with 80 additions and 10 deletions

32
entrypoint.sh.tmpl Normal file
View File

@ -0,0 +1,32 @@
#!/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 "AWS_SECRET_ACCESS_KEY"
file_env "OIDC_CLIENT_SECRET"
file_env "UTILS_SECRET"
file_env "DATABASE_PASSWORD"
export DATABASE_URL="postgres://outline:${DATABASE_PASSWORD}@${STACK_NAME}_postgres:5432/outline"