Skip to content

Commit

Permalink
Provide a way to skip the templating for torrc (#164)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
thomasleplus and github-actions[bot] authored Dec 28, 2024
1 parent 81ebdde commit b2a1869
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tor/tor-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2a1869

Please sign in to comment.