changeset 95:33f9610480ea

docker (libervia_cont): SAT_CONT_PORT_<port> environment variable can now be used to specify destination ports when -p is used
author Goffi <goffi@goffi.org>
date Wed, 24 Feb 2016 20:24:05 +0100
parents eeff161a19e8
children c425b8a99a29
files docker/libervia_cont.sh
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/docker/libervia_cont.sh	Wed Feb 24 20:21:34 2016 +0100
+++ b/docker/libervia_cont.sh	Wed Feb 24 20:24:05 2016 +0100
@@ -24,6 +24,7 @@
 # SAT_CONT_DOMAIN for the host name
 # SAT_CONT_BACKUP_DIR is the directory where tar.gz backup will be written
 # SAT_CONT_DK_EXTRA is used for extra options (used with all containers but sat_data)
+# SAT_CONT_PORT_<port> is used to specify port when -p is used, <port> must be an exposed port
 
 CONTAINERS="prosody sat_pubsub salut sat libervia"
 
@@ -114,7 +115,13 @@
     ports=$(get_dyn_var $cont ports)
     ARG=""
     for port in $ports; do
-        ARG="$ARG -p $port:$port"
+        host_port=$(eval echo "\$SAT_CONT_PORT_${port}")
+        if [ -z "$host_port" ]; then
+            host_port=$port
+        fi
+        if [ "$host_port" != 0 ]; then
+            ARG="$ARG -p $host_port:$port"
+        fi
     done
     echo $ARG
 }
@@ -256,7 +263,7 @@
         done
         printf '\nLibervia is launched and should be reachable in a couple of seconds.\nYou can check logs with "docker logs -f libervia" (or any other container name).\n'
         printf "An \"admin\" account has been created, you can check its password on $VOLUME_ALIAS container, in file /home/sat/ADMIN_PWD. Config can be tuned on this container.\n"
-        printf 'Below are the ports used to connect, you can go with your browser to Libervia HTTP port.\n\n'
+        printf 'Below are the ports used to connect, you can go with your browser to Libervia HTTP(S) port.\n\n'
         list_ports
         ;;
     STOP)