Add turn_secret via entrypoint

This commit is contained in:
kimbl 2024-10-02 15:48:09 +02:00
parent 3f9dd1ccd6
commit 87abadb510

View File

@ -2,6 +2,7 @@
set -e
apk add jq su-exec
# create certs for proxy
if [ "$ENABLE_HTTPS_PROXY" == true ]; then
while [ ! -f /etc/resty-auto-ssl/storage/file/*latest ]
@ -24,16 +25,20 @@ if [ ! -f /tmp/cert.pem ] || [ ! -f /tmp/key.pem ]; then
exit 1
fi
# If command starts with an option, prepend with turnserver binary.
#if [ "${1:0:1}" == '-' ]; then
# set -- turnserver "$@"
#fi
#su-exec nobody $(eval "echo $@")
# get turn_secret
# set turn_secret variable
if test -f "/run/secrets/turn_secret"; then
pwd=`cat /run/secrets/turn_secret`
if [ -z $pwd ]; then
echo >&2 "error: /run/secrets/turn_secret is empty"
exit 1
fi
echo "entrypoint.coturn.sh setting TURN_SECRET"
export "TURN_SECRET"="${pwd}"
unset "pwd"
else
echo >&2 "error: /run/secrets/turn_secret does not exist"
exit 1
fi
# start turnserver
su-exec nobody turnserver --static-auth-secret=${TURN_SECRET}"