summaryrefslogtreecommitdiff
path: root/packaging/docker
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-05-19 11:02:28 +0200
committerLinus Nordberg <linus@nordberg.se>2015-05-19 11:02:28 +0200
commite7404b41b7f8e9737f22c15f562cd9d338a8d91e (patch)
tree7a59daf74104a2468c0c184bd5ca89d29e820d1d /packaging/docker
parent631b0bf33561f891feeda7162a04644f245e9515 (diff)
[docker] Generate HiddenServicePort from $BACKEND_PORT.
Diffstat (limited to 'packaging/docker')
-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