Wasm-wc: Allow to use the 'reactor' adaptor again

With the initial port to wasmtime 17 we could no longer use the
'reactor' adaptor but had to switch to the more restrictive 'proxy'
adaptor.

This meant amongst other things (probably) we could no longer access the
filesystem.

Thanks to Joel Dice for pointing out the fix.

With this we can go back to using the 'reactor' adaptor again and things
are back to working as before.

It's worth noting that you can use either the 'proxy' or 'reactor'
adaptor depending on your requirements.

Cc: Joel Dice <joel.dice@fermyon.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
Andrew Clayton
2024-02-13 16:21:49 +00:00
parent 98f808af2c
commit 60eb6c43a7

View File

@@ -200,7 +200,8 @@ impl GlobalState {
let component = Component::from_file(&engine, &global_config.component)
.context("failed to compile component")?;
let mut linker = Linker::<StoreState>::new(&engine);
wasmtime_wasi_http::proxy::add_to_linker(&mut linker)?;
wasmtime_wasi::preview2::command::add_to_linker(&mut linker)?;
wasmtime_wasi_http::proxy::add_only_http_to_linker(&mut linker)?;
let component = linker
.instantiate_pre(&component)
.context("failed to pre-instantiate the provided component")?;