1
0

support recent wasm modules

This commit is contained in:
Konstantin Demin 2025-04-23 17:30:50 +03:00
parent 954d6a6565
commit 203aa84365
Signed by: krd
GPG Key ID: 4D56F87A8BA65FD0
9 changed files with 46 additions and 2 deletions

@ -0,0 +1 @@
load_module modules.d/ngx_wamr_module.so;

@ -0,0 +1,2 @@
load_module modules.d/ngx_wasm_module.so;
load_module modules.d/ngx_wasm_core_module.so;

@ -0,0 +1 @@
load_module modules.d/ngx_wasmtime_module.so;

@ -0,0 +1 @@
load_module modules.d/ngx_http_wasm_host_module.so;

@ -32,6 +32,23 @@ for i in ${NGX_CORE_MODULES:-} ; do
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}")

@ -47,9 +47,9 @@ else
http_confload="${http_confload} v2"
fi
## angie-module-lua: depends on angie-module-ndk
## angie-module-set-misc: depends on angie-module-ndk
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
@ -62,6 +62,28 @@ else
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
unset want_wasm
want_wasm=0
if list_have_item "${http_modules}" wasm ; then
want_wasm=1
fi
if [ ${want_wasm} = 1 ] ; then
unset have_core_wasm
have_core_wasm=0
if list_have_item "${NGX_CORE_MODULES}" wasm ; then
have_core_wasm=1
fi
if [ ${have_core_wasm} = 0 ] ; then
log_always "adjusting NGX_CORE_MODULES to include 'wasm'"
NGX_CORE_MODULES=$(append_list "${NGX_CORE_MODULES}" wasm)
export NGX_CORE_MODULES
fi
unset have_core_wasm
fi
unset want_wasm
fi
set -a