|
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; do |
| 16 | + for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass swag_server_custom_directive; 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; do |
| 43 | + for VAR in swag_address swag_port swag_proto swag_url swag_auth swag_auth_bypass swag_server_custom_directive; do |
44 | 44 | VAR_VALUE=$(echo ${INSPECTION} | jq -r ".[0].Config.Labels[\"${VAR}\"]") |
45 | 45 | if [ "${VAR_VALUE}" == "null" ]; then |
46 | 46 | VAR_VALUE="" |
@@ -71,6 +71,11 @@ for CONTAINER in ${AUTO_GEN}; do |
71 | 71 | sed -i "s|server_name .*|server_name ${SED_swag_url};|" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
72 | 72 | echo "**** Overriding url as ${swag_url} for ${CONTAINER} ****" |
73 | 73 | fi |
| 74 | + if [ -n "${swag_server_custom_directive}" ]; then |
| 75 | + SED_swag_server_custom_directive=$(sed -e 's/[&\\|]/\\&/g; s|$|\\|; $s|\\$||' <<<"${swag_server_custom_directive}") |
| 76 | + sed -i -e '/include.*ssl.conf;/a\' -e " ${SED_swag_server_custom_directive}" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
| 77 | + echo "**** Adding custom directive from the swag_server_custom_directive label for ${CONTAINER} ****" |
| 78 | + fi |
74 | 79 | if [ "${swag_auth}" == "authelia" ]; then |
75 | 80 | sed -i "s|#include /config/nginx/authelia|include /config/nginx/authelia|g" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
76 | 81 | echo "**** Enabling Authelia for ${CONTAINER} ****" |
@@ -137,6 +142,11 @@ DUDE |
137 | 142 | SED_swag_url=$(sed -e 's/[&\\|]/\\&/g; s|$|\\|; $s|\\$||' <<<"${swag_url}") |
138 | 143 | sed -i "s|server_name .*|server_name ${SED_swag_url};|" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
139 | 144 | echo "**** Setting url ${swag_url} for ${CONTAINER} ****" |
| 145 | + if [ -n "${swag_server_custom_directive}" ]; then |
| 146 | + SED_swag_server_custom_directive=$(sed -e 's/[&\\|]/\\&/g; s|$|\\|; $s|\\$||' <<<"${swag_server_custom_directive}") |
| 147 | + sed -i -e '/include.*ssl.conf;/a\' -e " ${SED_swag_server_custom_directive}" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
| 148 | + echo "**** Adding custom directive from the swag_server_custom_directive label for ${CONTAINER} ****" |
| 149 | + fi |
140 | 150 | if [ "${swag_auth}" == "authelia" ]; then |
141 | 151 | sed -i "s|#include /config/nginx/authelia|include /config/nginx/authelia|g" "/etc/nginx/http.d/auto-proxy-${CONTAINER}.subdomain.conf" |
142 | 152 | echo "**** Enabling Authelia for ${CONTAINER} ****" |
|
0 commit comments