2021-05-06 13:14:25 +00:00
|
|
|
#!/bin/env sh
|
2021-03-19 16:03:13 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-05-06 13:24:53 +00:00
|
|
|
file_env() {
|
|
|
|
local var="$1"
|
|
|
|
local fileVar="${var}_FILE"
|
|
|
|
local def="${2:-}"
|
2021-03-19 16:03:13 +00:00
|
|
|
|
2021-05-06 13:24:53 +00:00
|
|
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
|
|
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-05-06 11:00:04 +00:00
|
|
|
|
2021-05-06 13:24:53 +00:00
|
|
|
local val="$def"
|
|
|
|
|
|
|
|
if [ "${!var:-}" ]; then
|
|
|
|
val="${!var}"
|
|
|
|
elif [ "${!fileVar:-}" ]; then
|
|
|
|
val="$(< "${!fileVar}")"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export "$var"="$val"
|
|
|
|
unset "$fileVar"
|
|
|
|
}
|
|
|
|
|
|
|
|
file_env "PEERTUBE_DB_PASSWORD"
|
|
|
|
file_env "PEERTUBE_SMTP_PASSWORD"
|
2021-05-06 10:59:25 +00:00
|
|
|
|
2021-05-06 11:32:01 +00:00
|
|
|
# upstream entrypoint
|
|
|
|
# https://github.com/Chocobozzz/PeerTube/blob/66f77f63437c6774acbd72584a9839a7636ea167/support/docker/production/entrypoint.sh
|
2021-05-06 11:24:20 +00:00
|
|
|
/usr/local/bin/entrypoint.sh "$@"
|