From d47d8d5c2c2abab24ec66e1011d1fabc4f3eb5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=A4fer?= Date: Wed, 9 Nov 2016 11:23:33 +0100 Subject: [PATCH] Make network and netmask configurable via environment parameter --- helpers/run.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helpers/run.sh b/helpers/run.sh index 863ae5e..8d07dc3 100755 --- a/helpers/run.sh +++ b/helpers/run.sh @@ -1,6 +1,8 @@ #!/bin/sh dest=${dest:-docker.ovpn} +network=${DOCKER_NETWORK:-172.16.0.0} +netmask=${DOCKER_NETMASK:-255.240.0.0} if [ ! -f "/local/$dest" ]; then echo "*** REGENERATING ALL CONFIGS ***" @@ -10,10 +12,7 @@ if [ ! -f "/local/$dest" ]; then sed -i 's|^push|#push|' /etc/openvpn/openvpn.conf echo localhost | ovpn_initpki nopass easyrsa build-client-full host nopass - ovpn_getclient host | sed ' - s|localhost 1194|localhost 13194|; - s|redirect-gateway.*|route 172.16.0.0 255.240.0.0|; - ' > "/local/$dest" + ovpn_getclient host | sed "s|localhost 1194|localhost 13194|;s|redirect-gateway.*|route ${network} ${netmask}|;" > "/local/$dest" fi exec ovpn_run