From e7404b41b7f8e9737f22c15f562cd9d338a8d91e Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 19 May 2015 11:02:28 +0200 Subject: [docker] Generate HiddenServicePort from $BACKEND_PORT. --- packaging/docker/onion/start.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'packaging/docker/onion') 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://:. 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 -- cgit v1.1