#!/bin/sh set -eu export CLEARNET_DOMAIN if [ -n "${ONION_HOSTNAME:-}" ]; then export ONION_LOCATION_HEADER="add_header Onion-Location \"http://${ONION_HOSTNAME}\$request_uri\";" else export ONION_LOCATION_HEADER="" fi envsubst '${CLEARNET_DOMAIN} ${ONION_LOCATION_HEADER}' \ < /etc/nginx/templates/conf.d/clearnet.conf.template \ > /etc/nginx/conf.d/clearnet.conf cp /etc/nginx/templates/conf.d/onion.conf /etc/nginx/conf.d/onion.conf exec nginx -g 'daemon off;'