mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
add option to enable WASI for script.wasm processor
This commit is contained in:
@@ -72,6 +72,18 @@ func init() {
|
||||
functionString = specificFunctionString
|
||||
}
|
||||
|
||||
enableWasiBool := false
|
||||
|
||||
enableWasi, ok := params["enableWasi"]
|
||||
|
||||
if ok {
|
||||
specificEnableWasi, ok := enableWasi.(bool)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("script.wasm enableWasi must be a boolean")
|
||||
}
|
||||
enableWasiBool = specificEnableWasi
|
||||
}
|
||||
|
||||
manifest := extism.Manifest{
|
||||
Wasm: []extism.Wasm{
|
||||
extism.WasmFile{
|
||||
@@ -80,7 +92,9 @@ func init() {
|
||||
},
|
||||
}
|
||||
|
||||
program, err := extism.NewCompiledPlugin(context.Background(), manifest, extism.PluginConfig{}, []extism.HostFunction{})
|
||||
program, err := extism.NewCompiledPlugin(context.Background(), manifest, extism.PluginConfig{
|
||||
EnableWasi: enableWasiBool,
|
||||
}, []extism.HostFunction{})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -654,6 +654,10 @@
|
||||
"function": {
|
||||
"type": "string",
|
||||
"default": "process"
|
||||
},
|
||||
"enableWasi": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"required": ["path"],
|
||||
|
||||
Reference in New Issue
Block a user