|
1 | 1 | #!/usr/bin/with-contenv bash |
2 | 2 |
|
3 | 3 | AUTO_GEN="" |
| 4 | +REMOVED_CONTAINERS="" |
4 | 5 | # figure out which containers to generate confs for or which confs to remove |
5 | 6 | if [ ! -f /auto-proxy/enabled_containers_"$DOCKER_HOST_NAME" ]; then |
6 | 7 | docker ps --filter "label=swag=enable" --format "{{.Names}}" > /auto-proxy/enabled_containers_"$DOCKER_HOST_NAME" |
@@ -187,11 +188,26 @@ DUDE |
187 | 188 | fi |
188 | 189 | done |
189 | 190 |
|
190 | | -if ([ -n "${AUTO_GEN}" ] || [ "${REMOVED_CONTAINERS}" == "true" ]) && ps aux | grep [n]ginx: > /dev/null; then |
191 | | - if /usr/sbin/nginx -c /config/nginx/nginx.conf -t; then |
192 | | - echo "**** Changes to nginx config are valid, reloading nginx ****" |
193 | | - /usr/sbin/nginx -c /config/nginx/nginx.conf -s reload |
194 | | - else |
195 | | - echo "**** Changes to nginx config are not valid, skipping nginx reload. Please double check the config including the auto-proxy confs. ****" |
196 | | - fi |
| 191 | +if [ "${DIAG_EXIT}" == "true" ]; then |
| 192 | + if ([ -n "${AUTO_GEN}" ] || [ "${REMOVED_CONTAINERS}" == "true" ]) && ps aux | grep [n]ginx: > /dev/null; then |
| 193 | + if /usr/sbin/nginx -c /config/nginx/nginx.conf -t; then |
| 194 | + echo "**** $DOCKER_HOST_NAME - Changes to nginx config are valid ****" |
| 195 | + return 200; |
| 196 | + else |
| 197 | + echo "**** $DOCKER_HOST_NAME - Changes to nginx config are not valid. Please double check the config including the auto-proxy confs. ****" |
| 198 | + return 201; |
| 199 | + fi |
| 200 | + else |
| 201 | + return 0; |
| 202 | + fi |
| 203 | +else |
| 204 | + if ([ -n "${AUTO_GEN}" ] || [ "${REMOVED_CONTAINERS}" == "true" ]) && ps aux | grep [n]ginx: > /dev/null; then |
| 205 | + if /usr/sbin/nginx -c /config/nginx/nginx.conf -t; then |
| 206 | + echo "**** $DOCKER_HOST_NAME - Changes to nginx config are valid, reloading nginx ****" |
| 207 | + /usr/sbin/nginx -c /config/nginx/nginx.conf -s reload |
| 208 | + else |
| 209 | + echo "**** $DOCKER_HOST_NAME - Changes to nginx config are not valid, skipping nginx reload. Please double check the config including the auto-proxy confs. ****" |
| 210 | + fi |
| 211 | + fi |
197 | 212 | fi |
| 213 | + |
0 commit comments