#!/bin/sh if [ "${NGX_HTTP}" = 1 ] ; then unset http_modules http_confload http_modules= http_confload="${NGX_HTTP_CONFLOAD:-}" if [ -n "${NGX_HTTP_MODULES}" ] ; then ## angie-module-lua: depends on angie-module-ndk ## angie-module-set-misc: depends on angie-module-ndk NGX_HTTP_MODULES=$( printf '%s' "${NGX_HTTP_MODULES}" \ | sed -zE 's/(\s|^)(lua|set-misc)(\s|$)/\1ndk \2\3/g' ) fi ## filter out builtin http modules unset i for i in ${NGX_HTTP_MODULES:-} ; do [ -n "$i" ] || continue case "$i" in */* | *\** | *\?* ) log_always "module '$i' is not legal, skipping" continue ;; esac if is_builtin_module http "$i" ; then log "$i is builtin module, moving to NGX_HTTP_CONFLOAD" http_confload="${http_confload} $i" continue fi ## naive deduplication case " ${http_modules} " in *" $i "* ) log "$i is already specified" continue ;; esac http_modules="${http_modules}${http_modules:+ }$i" done unset i set -a NGX_HTTP_MODULES="${http_modules}" NGX_HTTP_CONFLOAD=$(sort_dedup_list "${http_confload}") set +a unset http_modules http_confload ## quirk: angie-module-modsecurity unset NGX_HTTP_WITH_MODSECURITY NGX_HTTP_WITH_MODSECURITY=0 while : ; do case " ${NGX_HTTP_MODULES} " in *" modsecurity "* ) ;; * ) break ;; esac for d in /angie/modules /etc/angie/modules /etc/angie/modules.dist ; do [ -d "$d" ] || continue if [ -f "$d/ngx_http_modsecurity_module.so" ] ; then NGX_HTTP_WITH_MODSECURITY=1 break fi done ; unset d break ; done export NGX_HTTP_WITH_MODSECURITY if [ "${NGX_HTTP_WITH_MODSECURITY}" = 1 ] ; then set -a NGX_DIRS_MERGE=$(sort_dedup_list "${NGX_DIRS_MERGE} modsecurity") set +a fi fi