1
0
angie-conv-image/image-entry.d/21-http-modules.envsh

49 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
if [ "${NGX_HTTP}" = 1 ] ; then
unset http_modules http_snippets
http_modules=
http_snippets="${NGX_HTTP_SNIPPETS:-}"
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
if is_builtin_module http "$i" ; then
log "$i is builtin module, moving to snippets"
http_snippets="${http_snippets}${http_snippets:+ }$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
http_snippets=$(sort_dedup_list "${http_snippets}")
set -a
NGX_HTTP_MODULES="${http_modules}"
NGX_HTTP_SNIPPETS="${http_snippets}"
set +a
unset http_modules http_snippets
fi