#!/bin/sh set -eu : "${PLAYER_ORIGIN:?PLAYER_ORIGIN must be set}" if ! printf '%s' "$PLAYER_ORIGIN" | grep -Eq '^https?://[A-Za-z0-9._:-]+$'; then echo "PLAYER_ORIGIN must be an origin such as http://192.168.1.20:3000" >&2 exit 64 fi envsubst '${PLAYER_ORIGIN}' \ < /etc/nginx/templates/nginx.conf.template \ > /tmp/nginx.conf nginx -t -c /tmp/nginx.conf exec nginx -c /tmp/nginx.conf -g 'daemon off;'