Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant