#!/bin/sh unset core_modules core_confload core_modules= core_confload="${NGX_CORE_CONFLOAD:-}" ## filter out builtin core modules unset i for i in ${NGX_CORE_MODULES:-} ; do [ -n "$i" ] || continue case "$i" in */* | *\** | *\?* ) log_always "module '$i' is not legal, skipping" continue ;; esac if is_builtin_module core "$i" ; then log "$i is builtin module, moving to NGX_CORE_CONFLOAD" core_confload=$(append_list "${core_confload}" "$i") continue fi ## naive deduplication if list_have_item "${core_modules}" "$i" ; then log "$i is already specified" continue fi core_modules=$(append_list "${core_modules}" "$i") done ; unset i if [ -n "${core_modules:-}" ] ; then ## angie-module-wamr: depends on angie-module-wasm ## angie-module-wasmtime: depends on angie-module-wasm unset want_wasm ; want_wasm=0 if list_have_item "${core_modules}" wamr ; then want_wasm=1 elif list_have_item "${core_modules}" wasmtime ; then want_wasm=1 fi if [ ${want_wasm} = 1 ] ; then ## forcefully move 'wasm' to beginning of list core_modules=$(printf '%s' " ${core_modules} " | sed -zE 's/ wasm / /;s/^/wasm/;s/ $//') fi unset want_wasm fi set -a NGX_CORE_MODULES="${core_modules}" NGX_CORE_CONFLOAD=$(sort_dedup_list "${core_confload}") NGX_CORE_EVENTS_CONFLOAD=$(sort_dedup_list "${NGX_CORE_EVENTS_CONFLOAD}") set +a unset core_modules core_confload