Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

provide json package alternative #36

Closed
mathetake opened this issue Sep 9, 2020 · 2 comments
Closed

provide json package alternative #36

mathetake opened this issue Sep 9, 2020 · 2 comments

Comments

@mathetake
Copy link
Member

somewhat related to #12

@mathetake
Copy link
Member Author

After TinyGo supports WASI, we could use https://github.com/vugu/vjson

@mathetake
Copy link
Member Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant