tor-container/assets/entrypoint.sh

25 lines
886 B
Bash
Executable file

#!/bin/sh
# Defaults
ENABLE_VANGUARDS=${ENABLE_VANGUARDS:-true}
ENABLE_TOR=${ENABLE_TOR:-true}
# If user specifically requests to disable Vanguards
if [ "$ENABLE_VANGUARDS" = "false" ]; then
echo "Disabling Vanguards service..."
sed -i '/- vanguards/d' /entrypoint-config.yml
fi
# If user specifically requests to disable Tor (e.g. for sidecar mode)
if [ "$ENABLE_TOR" = "false" ]; then
echo "Disabling Tor service..."
sed -i '/- tor/d' /entrypoint-config.yml
# In sidecar mode, we don't want to auto-resolve the control port using local defaults.
# We remove the line that sets TOR_CONTROL_PORT via 'onions --resolve-control-port'
# so that the environment variable passed to the container is preserved.
sed -i '/TOR_CONTROL_PORT: onions --resolve-control-port/d' /entrypoint-config.yml
fi
# Pass control to pyentrypoint
exec pyentrypoint "$@"