summaryrefslogtreecommitdiff
path: root/packaging/docker/onion
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/docker/onion')
-rw-r--r--packaging/docker/onion/start.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/packaging/docker/onion/start.sh b/packaging/docker/onion/start.sh
index 7a6892e..dce48af 100644
--- a/packaging/docker/onion/start.sh
+++ b/packaging/docker/onion/start.sh
@@ -1,6 +1,14 @@
#! /bin/sh
-[ -z "${HSPORT}" ] && HSPORT=80
+# BACKEND_PORT is set by `docker run --link BACKEND:foo' on the form
+# tcp://<ip>:<port>. See https://docs.docker.com/userguide/dockerlinks/.
+
+if [ -n "${HSPORT}" ]; then
+ HSPORT=80 # Default localhost:80 -> .onion:80
+ if [ -n "${BACKEND_PORT}" ]; then
+ HSPORT="80 "$(echo ${BACKEND_PORT} | sed 's|^.*://||1')
+ fi
+fi
if ! [ -e /etc/tor/torrc ]; then
echo "SocksPort 0" >> /etc/tor/torrc