23 lines
592 B
Bash
Executable File
23 lines
592 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
THT_FRONTEND_API_UPSTREAM=${THT_FRONTEND_API_UPSTREAM:-http://core:8787}
|
|
if ! /usr/local/bin/validate-frontend-api-upstream "$THT_FRONTEND_API_UPSTREAM"; then
|
|
echo "Invalid THT_FRONTEND_API_UPSTREAM: expected internal http://core:8787" >&2
|
|
exit 2
|
|
fi
|
|
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;'
|