mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
Merge pull request #63 from jwetzell/feat/script-wasm-wasi
add option to enable WASI for script.wasm processor
This commit is contained in:
@@ -72,6 +72,18 @@ func init() {
|
|||||||
functionString = specificFunctionString
|
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{
|
manifest := extism.Manifest{
|
||||||
Wasm: []extism.Wasm{
|
Wasm: []extism.Wasm{
|
||||||
extism.WasmFile{
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -654,6 +654,10 @@
|
|||||||
"function": {
|
"function": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "process"
|
"default": "process"
|
||||||
|
},
|
||||||
|
"enableWasi": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["path"],
|
"required": ["path"],
|
||||||
|
|||||||
Reference in New Issue
Block a user