Skip to content

Commit

Permalink
use more selective if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
aptalca committed Dec 5, 2024
1 parent 63db34a commit 70268ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions root/app/auto-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ for CONTAINER in ${AUTO_GEN}; do
if [ -n "${swag_address}" ]; then
sed -i "s|set \$upstream_app .*|set \$upstream_app ${swag_address};|g" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf"
echo "**** Overriding address as ${swag_address} for ${CONTAINER} ****"
elif [ -n "${swag_preset_conf}" ] && [ -f "/config/nginx/proxy-confs/${swag_preset_conf}.subdomain.conf.sample" ]; then
elif [ ! -f "/config/nginx/proxy-confs/${CONTAINER}.subdomain.conf.sample" ] && [ -n "${swag_preset_conf}" ] && [ -f "/config/nginx/proxy-confs/${swag_preset_conf}.subdomain.conf.sample" ]; then
sed -i "s|set \$upstream_app .*|set \$upstream_app ${CONTAINER};|g" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf"
echo "**** Overriding address as ${CONTAINER} for ${CONTAINER} ****"
fi
Expand All @@ -78,7 +78,7 @@ for CONTAINER in ${AUTO_GEN}; do
SED_swag_url=$(sed -e 's/[&\\|]/\\&/g; s|$|\\|; $s|\\$||' <<<"${swag_url}")
sed -i "s|server_name .*|server_name ${SED_swag_url};|" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf"
echo "**** Overriding url as ${swag_url} for ${CONTAINER} ****"
elif [ -n "${swag_preset_conf}" ] && [ -f "/config/nginx/proxy-confs/${swag_preset_conf}.subdomain.conf.sample" ]; then
elif [ ! -f "/config/nginx/proxy-confs/${CONTAINER}.subdomain.conf.sample" ] && [ -n "${swag_preset_conf}" ] && [ -f "/config/nginx/proxy-confs/${swag_preset_conf}.subdomain.conf.sample" ]; then
sed -i "s|server_name .*|server_name ${CONTAINER}.*;|" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf"
echo "**** Overriding url as ${CONTAINER}.* for ${CONTAINER} ****"
fi
Expand Down

0 comments on commit 70268ef

Please sign in to comment.