From b2a1869d7ccad8683c0cf00e7e699acccb0194c0 Mon Sep 17 00:00:00 2001 From: Thomas Leplus Date: Sun, 29 Dec 2024 11:12:34 +1200 Subject: [PATCH] Provide a way to skip the templating for torrc (#164) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- README.md | 5 +++++ tor/tor-wrapper.sh | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index b2c5aa6..5e74a2e 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ available: Note that the defaults are the same as Tor's default if the configuration option is not set. +If you set the SKIP_TEMPLATE variable to any value, the whole +templating logic will be disabled and the configuration file +/etc/tor/torrc will be used as is (either the default one provided by +Tor or yours if you mount one in the container). + You can use the `-m` option of Docker to mount a custom template in the image at `/etc/tor/torrc.template`. The templating engine (`envsubst`) will only replace specific environment variables in the diff --git a/tor/tor-wrapper.sh b/tor/tor-wrapper.sh index 5a312fe..91687dd 100755 --- a/tor/tor-wrapper.sh +++ b/tor/tor-wrapper.sh @@ -22,6 +22,12 @@ if [ -f '/etc/torrc' ]; then \echo 'DEBUG: Found existing /etc/torrc, overwritting /etc/tor/torrc.' fi \cp -f '/etc/torrc' '/etc/tor/torrc' + \echo 'WARN: Found configuration file at deprecated location /etc/torrc. Please use /etc/tor/torrc instead or it will stop working in future releases of this image.' +elif [ -n "${SKIP_TEMPLATE+x}" ]; then + if [ "${DEBUG}" = true ]; then + \echo "DEBUG: Skipping templating since SKIP_TEMPLATE is set." + fi + \echo "Skipping templating." else if [ -n "${SHELL_FORMAT+x}" ]; then if [ "${DEBUG}" = true ]; then