#!/bin/sh if [ "${NGX_HTTP}" = 0 ] ; then unset NGX_HTTP_V2 NGX_HTTP_V3 NGX_HTTP_PROXY else set -a NGX_HTTP_V2=$(gobool_to_int "${NGX_HTTP_V2:-0}" 0) NGX_HTTP_V3=$(gobool_to_int "${NGX_HTTP_V3:-0}" 0) NGX_HTTP_PROXY=$(gobool_to_int "${NGX_HTTP_PROXY:-1}" 1) set +a unset http_modules http_confload http_modules= http_confload="${NGX_HTTP_CONFLOAD:-}" ## 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=$(append_list "${http_confload}" "$i") continue fi ## naive deduplication if list_have_item "${http_modules}" "$i" ; then log "$i is already specified" continue fi http_modules=$(append_list "${http_modules}" "$i") done ; unset i ## grpc depends on http/2 if list_have_item "${http_confload}" grpc ; then http_confload="${http_confload} v2" fi ## fixes if list_have_item "${http_confload}" v2 ; then export NGX_HTTP_V2=1 fi if list_have_item "${http_confload}" v3 ; then export NGX_HTTP_V3=1 fi if list_have_item "${http_confload}" proxy ; then export NGX_HTTP_PROXY=1 fi ## adjustments [ "${NGX_HTTP_V2}" = 0 ] || http_confload="${http_confload} v2" [ "${NGX_HTTP_V3}" = 0 ] || http_confload="${http_confload} v3" [ "${NGX_HTTP_PROXY}" = 0 ] || http_confload="${http_confload} proxy" if [ -n "${http_modules:-}" ] ; then ## angie-module-lua: depends on angie-module-ndk ## angie-module-set-misc: depends on angie-module-ndk unset want_ndk ; want_ndk=0 if list_have_item "${http_modules}" lua ; then want_ndk=1 elif list_have_item "${http_modules}" set-misc ; then want_ndk=1 fi if [ ${want_ndk} = 1 ] ; then ## forcefully move 'ndk' to beginning of list http_modules=$(printf '%s' " ${http_modules} " | sed -zE 's/ ndk / /;s/^/ndk/;s/ $//') fi unset want_ndk ## angie-module-wasm: http module requires core module to be loaded too while : ; do list_have_item "${http_modules}" wasm || break if list_have_item "${NGX_CORE_MODULES}" wasm ; then break ; fi log_always "adjusting NGX_CORE_MODULES to include 'wasm'" NGX_CORE_MODULES=$(append_list "${NGX_CORE_MODULES}" wasm) export NGX_CORE_MODULES break ; done fi set -a NGX_HTTP_MODULES="${http_modules}" NGX_HTTP_CONFLOAD=$(sort_dedup_list "${http_confload}") set +a unset http_modules http_confload ## adjust caches unset m for m in fastcgi proxy scgi uwsgi ; do list_have_item "${NGX_HTTP_CONFLOAD}" $m || continue NGX_HTTP_CACHES="${NGX_HTTP_CACHES} temp_${m}" done ; unset m NGX_HTTP_CACHES=$(sort_dedup_list "${NGX_HTTP_CACHES}") fi