generated from coop-cloud/example
46 lines
983 B
Bash
46 lines
983 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
|
|
|
|
declare -x -g "$var"="$val"
|
|
unset "$fileVar"
|
|
}
|
|
|
|
file_env "DB_PASS"
|
|
file_env "SMTP_PASSWORD"
|
|
file_env "OTP_SECRET"
|
|
file_env "SECRET_KEY_BASE"
|
|
file_env "VAPID_PRIVATE_KEY"
|
|
file_env "ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY"
|
|
file_env "ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"
|
|
file_env "ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY"
|
|
|
|
{{ if eq (env "OIDC_ENABLED") "true" }}
|
|
file_env "OIDC_CLIENT_SECRET"
|
|
{{ end }}
|
|
|
|
|
|
# NOTE: this was working in mastodon 4.2 but breaks in 4.3
|
|
# sed -i '/- admin$/d' /opt/mastodon/config/settings.yml
|
|
|
|
RAILS_ENV=production bundle exec rake db:migrate
|
|
|
|
/usr/bin/tini -s -- "$@"
|