This repository has been archived on 2024-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ccchh-pretix/entrypoint.sh

48 lines
1.2 KiB
Bash
Raw Normal View History

2023-12-03 12:50:23 +01:00
#!/bin/sh
set -e
if [ ! -s /etc/pretix/pretix.cfg ]; then
echo "Creating /etc/pretix/pretix.cfg from environment" >&2
missing=""
for i in PRETIX_INSTANCE_NAME PRETIX_URL DATABASE_BACKEND DATABASE_NAME DATABASE_USER DATABASE_PASSWORD DATABASE_HOST MAIL_FROM MAIL_HOST REDIS_LOCATION CELERY_BACKEND CELERY_BROKER; do
if eval "[ -z \"\${$i}\" ]"; then
missing="${missing} $i"
fi
done
if [ -n "${missing}" ]; then
echo "You need to set these environment variables to configure Pretix:$missing" >&2
exit 1
fi
cat >/etc/pretix/pretix.cfg <<EOF
[pretix]
instance_name=${PRETIX_INSTANCE_NAME}
url=${PRETIX_URL}
currency=${PRETIX_CURRENCY:-EUR}
datadir=${PRETIX_DATADIR:-/data}
trust_x_forwarded_for=${PRETIX_TRUST_X_FORWARDED_FOR:-on}
trust_x_forwarded_proto=${PRETIX_TRUST_X_FORWARDED_PROTO:-on}
[database]
backend=${DATABASE_BACKEND}
name=${DATABASE_NAME}
user=${DATABASE_USER}
password=${DATABASE_PASSWORD}
host=${DATABASE_HOST}
[mail]
from=${MAIL_FROM}
host=${MAIL_HOST}
[redis]
location=${REDIS_LOCATION}
sessions=${REDIS_SESSION:-true}
[celery]
backend=${CELERY_BACKEND}
broker=${CELERY_BROKER}
EOF
fi
2023-12-03 14:31:24 +01:00
exec pretix "$@"