1
0
angie-conv-image/image-entry.d/31-mail-modules.envsh
2024-09-17 14:11:00 +03:00

43 lines
870 B
Bash
Executable File

#!/bin/sh
if [ "${NGX_MAIL}" = 1 ] ; then
unset mail_modules mail_confload
mail_modules=
mail_confload="${NGX_MAIL_CONFLOAD:-}"
## filter out builtin mail modules
unset i
for i in ${NGX_MAIL_MODULES:-} ; do
[ -n "$i" ] || continue
case "$i" in
*/* | *\** | *\?* )
log_always "module '$i' is not legal, skipping"
continue
;;
esac
if is_builtin_module mail "$i" ; then
log "$i is builtin module, moving to NGX_MAIL_CONFLOAD"
mail_confload=$(append_list "${mail_confload}" "$i")
continue
fi
## naive deduplication
if list_have_item "${mail_modules}" "$i" ; then
log "$i is already specified"
continue
fi
mail_modules=$(append_list "${mail_modules}" "$i")
done
unset i
set -a
NGX_MAIL_MODULES="${mail_modules}"
NGX_MAIL_CONFLOAD=$(sort_dedup_list "${mail_confload}")
set +a
unset mail_modules mail_confload
fi