Mirror NullCart's ONION_HOSTNAME env and nginx clearnet header so visitors on HTTPS see ".onion available".
19 lines
485 B
Bash
Executable File
19 lines
485 B
Bash
Executable File
#!/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;'
|