diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-09-19 15:21:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-19 15:21:32 +0300 |
commit | f389cc5d9916a989f0675c2cdd58943fe2592360 (patch) | |
tree | 829b5448dc27771ffd3828fc34157bddbc1e24e1 /include/functions | |
parent | 36627a4eb7fb0d505c6df7897083d161e59cdf34 (diff) | |
parent | ccb8b2b6150bf4785ee5b4dce3856e2a961a5b2c (diff) |
Merge pull request #761 from Schmuuu/master
enhance nginx include config detection …
Diffstat (limited to 'include/functions')
-rw-r--r-- | include/functions | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/functions b/include/functions index 0024484f..3be7168a 100644 --- a/include/functions +++ b/include/functions @@ -2249,6 +2249,30 @@ if [ "${CONF}" = "${VALUE}" ]; then FOUND=1; LogText "Found this file already in our configuration files array (additions), not adding to queue"; fi done if [ ${FOUND} -eq 0 ]; then NGINX_CONF_FILES_ADDITIONS="${NGINX_CONF_FILES_ADDITIONS} ${VALUE}"; fi + # Check if include value is a relative path only + elif [ -f "${CONFIG_FILE%nginx.conf}${VALUE%;*}" ]; then + VALUE="${CONFIG_FILE%nginx.conf}${VALUE}" + FOUND=0 + for CONF in ${NGINX_CONF_FILES}; do + if [ "${CONF}" = "${VALUE}" ]; then FOUND=1; LogText "Found this file already in our configuration files array, not adding to queue"; fi + done + for CONF in ${NGINX_CONF_FILES_ADDITIONS}; do + if [ "${CONF}" = "${VALUE}" ]; then FOUND=1; LogText "Found this file already in our configuration files array (additions), not adding to queue"; fi + done + if [ ${FOUND} -eq 0 ]; then NGINX_CONF_FILES_ADDITIONS="${NGINX_CONF_FILES_ADDITIONS} ${VALUE}"; fi + # Check for additional config files included as follows + # "include sites-enabled/*.conf" + elif [ $(echo ${VALUE} | grep -F -c "*.conf") -gt 0 ]; then + for FOUND_CONF in $(ls ${CONFIG_FILE%nginx.conf}${VALUE%;*}); do + FOUND=0 + for CONF in ${NGINX_CONF_FILES}; do + if [ "${CONF}" = "${FOUND_CONF}" ]; then FOUND=1; LogText "Found this file already in our configuration files array, not adding to queue"; fi + done + for CONF in ${NGINX_CONF_FILES_ADDITIONS}; do + if [ "${CONF}" = "${FOUND_CONF}" ]; then FOUND=1; LogText "Found this file already in our configuration files array (additions), not adding to queue"; fi + done + if [ ${FOUND} -eq 0 ]; then NGINX_CONF_FILES_ADDITIONS="${NGINX_CONF_FILES_ADDITIONS} ${FOUND_CONF}"; fi + done else LogText "Result: this include does not point to a file" fi |