Closed mathetake closed 4 years ago
After TinyGo supports WASI, we could use https://github.com/vugu/vjson
func (ctx context) OnVMStart(vmConfigurationSize int) bool {
data, err := proxywasm.HostCallGetVMConfiguration(vmConfigurationSize)
if err != nil {
proxywasm.LogCritical("error reading vm configuration", err.Error())
}
var c map[string]interface{}
if err := vjson.Unmarshal(data, &c); err != nil {
panic(err)
}
proxywasm.LogInfo("vm config: \n", c["name"].(string))
return true
}
verified that it works with WASI target:
[2020-09-14 17:44:43.371][1014652][info][wasm] [external/envoy/source/extensions/common/wasm/context.cc:997] wasm log my_root_id: vm config:
vm configuration
somewhat related to #12