Files
ThothII/docker/frontend-entrypoint.sh
T

27 lines
641 B
Bash

#!/bin/sh
set -eu
THT_FRONTEND_API_UPSTREAM=${THT_FRONTEND_API_UPSTREAM:-http://core:8787}
THT_FRONTEND_API_UPSTREAM=${THT_FRONTEND_API_UPSTREAM%/}
case "$THT_FRONTEND_API_UPSTREAM" in
http://*|https://*) ;;
*)
echo "Invalid THT_FRONTEND_API_UPSTREAM: use an internal http(s) upstream" >&2
exit 2
;;
esac
export THT_FRONTEND_API_UPSTREAM
if ! envsubst '${THT_FRONTEND_API_UPSTREAM}' \
< /etc/nginx/templates/default.conf.template \
> /etc/nginx/conf.d/default.conf; then
echo "Unable to render nginx API upstream configuration" >&2
exit 2
fi
if [ "$#" -gt 0 ]; then
exec "$@"
fi
exec nginx -g 'daemon off;'