diff --git a/internal/processor/script-wasm.go b/internal/processor/script-wasm.go index 03f8eaa..8f8c477 100644 --- a/internal/processor/script-wasm.go +++ b/internal/processor/script-wasm.go @@ -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 diff --git a/schema/processors.schema.json b/schema/processors.schema.json index 6cbd71e..b9e00ec 100644 --- a/schema/processors.schema.json +++ b/schema/processors.schema.json @@ -654,6 +654,10 @@ "function": { "type": "string", "default": "process" + }, + "enableWasi": { + "type": "boolean", + "default": false } }, "required": ["path"],