modify entrypoint file to work using sh instead of bash, rtfm

This commit is contained in:
brooke 2025-01-10 17:04:57 -06:00
parent 81ca7f52d0
commit 726097711e

View File

@ -1,27 +1,15 @@
#!/bin/sh
set -e
if [ -f /run/secrets/oidc_secret ]; then
export GTS_OIDC_CLIENT_SECRET=$(cat /run/secrets/oidc_secret)
else
echo "OIDC secret not found, skipping."
fi
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ -f /run/secrets/smtp_password ]; then
export GTS_SMTP_PASSWORD=$(cat /run/secrets/smtp_password)
else
echo "SMTP password secret not found, skipping."
fi
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 "GTS_OIDC_CLIENT_SECRET"
file_env "GTS_SMTP_PASSWORD"
/gotosocial/gotosocial server start