|
13 | 13 | AUTO_GEN="${CONTAINER} ${AUTO_GEN}" |
14 | 14 | else |
15 | 15 | INSPECTION=$(docker inspect ${CONTAINER}) |
16 | | - for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass swag_server_custom_directive swag_preset_conf; do |
| 16 | + for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass swag_server_custom_directive swag_location_custom_directive swag_preset_conf; do |
17 | 17 | VAR_VALUE=$(echo ${INSPECTION} | jq -r ".[0].Config.Labels[\"${VAR}\"]") |
18 | 18 | if [ "${VAR_VALUE}" == "null" ]; then |
19 | 19 | VAR_VALUE="" |
|
40 | 40 | for CONTAINER in ${AUTO_GEN}; do |
41 | 41 | INSPECTION=$(docker inspect ${CONTAINER}) |
42 | 42 | rm -rf "/auto-proxy/${CONTAINER}.conf" |
43 | | - for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass swag_server_custom_directive swag_preset_conf; do |
| 43 | + for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass swag_server_custom_directive swag_location_custom_directive swag_preset_conf; do |
44 | 44 | VAR_VALUE=$(echo ${INSPECTION} | jq -r ".[0].Config.Labels[\"${VAR}\"]") |
45 | 45 | if [ "${VAR_VALUE}" == "null" ]; then |
46 | 46 | VAR_VALUE="" |
@@ -87,6 +87,11 @@ for CONTAINER in ${AUTO_GEN}; do |
87 | 87 | sed -i -e '/include.*ssl.conf;/a\' -e " ${SED_swag_server_custom_directive}" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
88 | 88 | echo "**** Adding custom directive from the swag_server_custom_directive label for ${CONTAINER} ****" |
89 | 89 | fi |
| 90 | + if [ -n "${swag_location_custom_directive}" ]; then |
| 91 | + SED_swag_location_custom_directive=$(sed -e 's/[&\\|]/\\&/g; s|$|\\|; $s|\\$||' <<<"${swag_location_custom_directive}") |
| 92 | + sed -i -e '/^[[:space:]]*proxy_pass.*;/a\' -e " ${SED_swag_location_custom_directive}" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
| 93 | + echo "**** Adding custom directive from the swag_location_custom_directive label for ${CONTAINER} ****" |
| 94 | + fi |
90 | 95 | if [ "${swag_auth}" == "authelia" ]; then |
91 | 96 | sed -i "s|#include /config/nginx/authelia|include /config/nginx/authelia|g" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
92 | 97 | echo "**** Enabling Authelia for ${CONTAINER} ****" |
@@ -164,6 +169,11 @@ DUDE |
164 | 169 | sed -i -e '/include.*ssl.conf;/a\' -e " ${SED_swag_server_custom_directive}" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
165 | 170 | echo "**** Adding custom directive from the swag_server_custom_directive label for ${CONTAINER} ****" |
166 | 171 | fi |
| 172 | + if [ -n "${swag_location_custom_directive}" ]; then |
| 173 | + SED_swag_location_custom_directive=$(sed -e 's/[&\\|]/\\&/g; s|$|\\|; $s|\\$||' <<<"${swag_location_custom_directive}") |
| 174 | + sed -i -e '/^[[:space:]]*proxy_pass.*;/a\' -e " ${SED_swag_location_custom_directive}" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
| 175 | + echo "**** Adding custom directive from the swag_location_custom_directive label for ${CONTAINER} ****" |
| 176 | + fi |
167 | 177 | if [ "${swag_auth}" == "authelia" ]; then |
168 | 178 | sed -i "s|#include /config/nginx/authelia|include /config/nginx/authelia|g" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
169 | 179 | echo "**** Enabling Authelia for ${CONTAINER} ****" |
|
0 commit comments