proxy-wasm-go-host icon indicating copy to clipboard operation
proxy-wasm-go-host copied to clipboard

Allow setting wazero module configuration

Open tylerflint opened this issue 1 year ago • 0 comments

This allows for setting critical wazero module configuration. For example, to use the host time:


import (
    "github.com/tetratelabs/wazero"
    wazeroHost "mosn.io/proxy-wasm-go-host/wazero"
)

...

// compile the wasm module
module := vm.NewModule(wasmBytes)

// create a new instance
instance = module.NewInstance()

// configure wazero module environment
conf := wazero.NewModuleConfig().WithSysWalltime().WithSysNanotime()

// set wazero config
wazeroHost.InstanceWithConfig(conf)(instance.(*wazeroHost.Instance))

// proceed as usual

...

tylerflint avatar Jul 22 '24 13:07 tylerflint