1313 AUTO_GEN=" ${CONTAINER} ${AUTO_GEN} "
1414 else
1515 INSPECTION=$( docker inspect ${CONTAINER} )
16- for VAR in swag_port swag_proto swag_url swag_auth swag_auth_bypass; do
16+ for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass; do
1717 VAR_VALUE=$( echo ${INSPECTION} | jq -r " .[0].Config.Labels[\" ${VAR} \" ]" )
1818 if [ " ${VAR_VALUE} " == " null" ]; then
1919 VAR_VALUE=" "
4040for CONTAINER in ${AUTO_GEN} ; do
4141 INSPECTION=$( docker inspect ${CONTAINER} )
4242 rm -rf " /auto-proxy/${CONTAINER} .conf"
43- for VAR in swag_port swag_proto swag_url swag_auth swag_auth_bypass; do
43+ for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass; do
4444 VAR_VALUE=$( echo ${INSPECTION} | jq -r " .[0].Config.Labels[\" ${VAR} \" ]" )
4545 if [ " ${VAR_VALUE} " == " null" ]; then
4646 VAR_VALUE=" "
@@ -54,17 +54,21 @@ for CONTAINER in ${AUTO_GEN}; do
5454 if [ -n " ${swag_auth_bypass} " ]; then
5555 echo " **** Swag auth bypass is auto managed via preset confs and cannot be overridden via env vars ****"
5656 fi
57+ if [ -n " ${swag_address} " ]; then
58+ sed -i " s|set \$ upstream_app .*|set \$ upstream_app ${swag_address} ;|g" " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
59+ echo " **** Overriding address as ${swag_address} for ${CONTAINER} ****"
60+ fi
5761 if [ -n " ${swag_port} " ]; then
5862 sed -i " s|set \$ upstream_port .*|set \$ upstream_port ${swag_port} ;|g" " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
59- echo " **** Overriding port for ${CONTAINER} ****"
63+ echo " **** Overriding port as ${swag_port} for ${CONTAINER} ****"
6064 fi
6165 if [ -n " ${swag_proto} " ]; then
6266 sed -i " s|set \$ upstream_proto .*|set \$ upstream_proto ${swag_proto} ;|g" " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
63- echo " **** Overriding proto for ${CONTAINER} ****"
67+ echo " **** Overriding proto as ${swag_proto} for ${CONTAINER} ****"
6468 fi
6569 if [ -n " ${swag_url} " ]; then
6670 sed -i " s|server_name .*|server_name ${swag_url} ;|" " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
67- echo " **** Overriding url for ${CONTAINER} ****"
71+ echo " **** Overriding url as ${swag_url} for ${CONTAINER} ****"
6872 fi
6973 if [ " ${swag_auth} " == " authelia" ]; then
7074 sed -i " s|#include /config/nginx/authelia|include /config/nginx/authelia|g" " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
@@ -100,7 +104,11 @@ DUDE
100104 done
101105 echo " }" >> " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
102106 fi
107+ if [ -z " ${swag_address} " ]; then
108+ swag_address=" ${CONTAINER} "
109+ fi
103110 sed -i " s|<container_name>|${CONTAINER} |g" " /etc/nginx/http.d/auto-proxy-${CONTAINER} .subdomain.conf"
111+ echo " **** Setting upstream address ${swag_address} for ${CONTAINER} ****"
104112 if [ -z " ${swag_port} " ]; then
105113 swag_port=$( docker inspect ${CONTAINER} | jq -r ' .[0].NetworkSettings.Ports | keys[0]' | sed ' s|/.*||' )
106114 if [ " ${swag_port} " == " null" ]; then
0 commit comments