improve module handling
This commit is contained in:
parent
9ca1528f41
commit
7c58559e27
@ -172,15 +172,12 @@ RUN apt-install.sh \
|
|||||||
|
|
||||||
## relatively lightweight modules
|
## relatively lightweight modules
|
||||||
RUN apt-install-angie-mod.sh \
|
RUN apt-install-angie-mod.sh \
|
||||||
auth-jwt \
|
|
||||||
auth-spnego \
|
|
||||||
brotli \
|
brotli \
|
||||||
cache-purge \
|
cache-purge \
|
||||||
echo \
|
echo \
|
||||||
geoip2 \
|
geoip2 \
|
||||||
headers-more \
|
headers-more \
|
||||||
subs \
|
subs \
|
||||||
testcookie \
|
|
||||||
upload \
|
upload \
|
||||||
zip \
|
zip \
|
||||||
zstd \
|
zstd \
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
## no extra configuration is present at this time
|
|
||||||
## ref: https://github.com/google/ngx_brotli/
|
|
@ -1,2 +0,0 @@
|
|||||||
## no extra configuration is present at this time
|
|
||||||
## ref: https://angie.software/en/configuration/modules/http_gzip_static/
|
|
@ -1,2 +0,0 @@
|
|||||||
## no extra configuration is present at this time
|
|
||||||
## ref: https://github.com/tokers/zstd-nginx-module/
|
|
@ -40,19 +40,19 @@ gobool_to_int() {
|
|||||||
|
|
||||||
IEP_TRACE=$(gobool_to_int "${IEP_TRACE:-0}" 0)
|
IEP_TRACE=$(gobool_to_int "${IEP_TRACE:-0}" 0)
|
||||||
export IEP_TRACE
|
export IEP_TRACE
|
||||||
if [ "${IEP_TRACE}" = 1 ] ; then
|
log_always() {
|
||||||
log_always() { echo "# $(date +'%Y-%m-%d %H:%M:%S.%03N %z'): ${__IEP_SRC}${*:+: $*}" >&2 ; }
|
if [ "${IEP_TRACE}" = 1 ] ; then
|
||||||
else
|
echo "# $(date +'%Y-%m-%d %H:%M:%S.%03N %z'): ${__IEP_SRC}${*:+: $*}"
|
||||||
log_always() { echo "# ${__IEP_SRC}${*:+: $*}" >&2 ; }
|
else
|
||||||
fi
|
echo "# ${__IEP_SRC}${*:+: $*}"
|
||||||
|
fi >&2
|
||||||
|
}
|
||||||
|
|
||||||
IEP_VERBOSE=$(gobool_to_int "${IEP_VERBOSE:-${IEP_TRACE}}" "${IEP_TRACE}")
|
IEP_VERBOSE=$(gobool_to_int "${IEP_VERBOSE:-${IEP_TRACE}}" "${IEP_TRACE}")
|
||||||
export IEP_VERBOSE
|
export IEP_VERBOSE
|
||||||
if [ "${IEP_VERBOSE}" = 1 ] ; then
|
log() {
|
||||||
log() { log_always "$@" ; }
|
[ "${IEP_VERBOSE}" = 0 ] || log_always "$@"
|
||||||
else
|
}
|
||||||
log() { : ;}
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_file() { sed -E '/^./s,^, ,' < "$1" >&2 ; }
|
log_file() { sed -E '/^./s,^, ,' < "$1" >&2 ; }
|
||||||
|
|
||||||
|
@ -5,6 +5,15 @@ if [ "${NGX_HTTP}" = 1 ] ; then
|
|||||||
http_modules=
|
http_modules=
|
||||||
http_snippets="${NGX_HTTP_SNIPPETS:-}"
|
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
|
## filter out builtin http modules
|
||||||
unset i
|
unset i
|
||||||
for i in ${NGX_HTTP_MODULES:-} ; do
|
for i in ${NGX_HTTP_MODULES:-} ; do
|
||||||
|
@ -21,15 +21,22 @@ rm -f "$t" ; unset t
|
|||||||
|
|
||||||
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
|
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
|
||||||
|
|
||||||
|
load_error_delim() {
|
||||||
|
IEP_TRACE=0 log_always ' ----------------------------------- '
|
||||||
|
}
|
||||||
load_error() {
|
load_error() {
|
||||||
[ "${load_error_seen:-}" = 1 ] || log_always 'tree combine has failed'
|
[ "${load_error_seen:-}" != 1 ] || return
|
||||||
load_error_seen=1
|
load_error_seen=1
|
||||||
|
load_error_delim
|
||||||
|
log_always 'tree combine has failed'
|
||||||
if [ "${NGX_STRICT_LOAD}" = 1 ] ; then
|
if [ "${NGX_STRICT_LOAD}" = 1 ] ; then
|
||||||
t=10
|
t=10
|
||||||
log_always "injecting delay for $t seconds"
|
log_always "injecting delay for $t seconds"
|
||||||
|
load_error_delim
|
||||||
sleep $t
|
sleep $t
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
load_error_delim
|
||||||
}
|
}
|
||||||
|
|
||||||
dirs='cache lib log'
|
dirs='cache lib log'
|
||||||
@ -140,8 +147,10 @@ combine_snippets() {
|
|||||||
old_path="${old_dir}/${old_name}"
|
old_path="${old_dir}/${old_name}"
|
||||||
if ! [ -f "${old_path}" ] ; then
|
if ! [ -f "${old_path}" ] ; then
|
||||||
log_always "file ${old_name} is not found in ${old_dir}/"
|
log_always "file ${old_name} is not found in ${old_dir}/"
|
||||||
|
if [ "${NGX_ALLOW_MISSING_SNIPPETS:-}" != 1 ] ; then
|
||||||
load_error
|
load_error
|
||||||
log "file ${old_name} is skipped"
|
log "file ${old_name} is skipped"
|
||||||
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -154,12 +163,17 @@ combine_modules http ${NGX_HTTP_MODULES:-}
|
|||||||
combine_modules mail ${NGX_MAIL_MODULES:-}
|
combine_modules mail ${NGX_MAIL_MODULES:-}
|
||||||
combine_modules stream ${NGX_STREAM_MODULES:-}
|
combine_modules stream ${NGX_STREAM_MODULES:-}
|
||||||
|
|
||||||
|
unset NGX_ALLOW_MISSING_SNIPPETS
|
||||||
|
|
||||||
combine_snippets core ${NGX_CORE_SNIPPETS:-}
|
combine_snippets core ${NGX_CORE_SNIPPETS:-}
|
||||||
combine_snippets core_ev ${NGX_CORE_EVENTS_SNIPPETS:-}
|
combine_snippets core_ev ${NGX_CORE_EVENTS_SNIPPETS:-}
|
||||||
combine_snippets http ${NGX_HTTP_SNIPPETS:-}
|
combine_snippets http ${NGX_HTTP_SNIPPETS:-}
|
||||||
combine_snippets mail ${NGX_MAIL_SNIPPETS:-}
|
combine_snippets mail ${NGX_MAIL_SNIPPETS:-}
|
||||||
combine_snippets stream ${NGX_STREAM_SNIPPETS:-}
|
combine_snippets stream ${NGX_STREAM_SNIPPETS:-}
|
||||||
|
|
||||||
|
## some modules doesn't have configuration at all
|
||||||
|
NGX_ALLOW_MISSING_SNIPPETS=1
|
||||||
|
|
||||||
combine_snippets core ${NGX_CORE_MODULES:-}
|
combine_snippets core ${NGX_CORE_MODULES:-}
|
||||||
combine_snippets http ${NGX_HTTP_MODULES:-}
|
combine_snippets http ${NGX_HTTP_MODULES:-}
|
||||||
combine_snippets mail ${NGX_MAIL_MODULES:-}
|
combine_snippets mail ${NGX_MAIL_MODULES:-}
|
||||||
|
@ -48,8 +48,8 @@ gen_mod_config() {
|
|||||||
[ -n "$3" ] || return
|
[ -n "$3" ] || return
|
||||||
|
|
||||||
for __m in $3 ; do
|
for __m in $3 ; do
|
||||||
echo "load_module ${__m};" >> "$2"
|
echo "load_module ${__m};"
|
||||||
done
|
done > "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
for i ; do
|
for i ; do
|
||||||
@ -87,7 +87,7 @@ for i ; do
|
|||||||
mail_modules=
|
mail_modules=
|
||||||
stream_modules=
|
stream_modules=
|
||||||
while read -r fmod ; do
|
while read -r fmod ; do
|
||||||
fmod_short="modules.dist/${fmod#"${ANGIE_MODULES_DIR}/"}"
|
fmod_short="modules.d/${fmod#"${ANGIE_MODULES_DIR}/"}"
|
||||||
fname=${fmod##*/}
|
fname=${fmod##*/}
|
||||||
case "${fname}" in
|
case "${fname}" in
|
||||||
ngx_http_* )
|
ngx_http_* )
|
||||||
|
Loading…
Reference in New Issue
Block a user