Closed amlwwalker closed 1 year ago
Hi @amlwwalker
Yes, it's possible to do with wazero WithFSConfig(FSConfig) ModuleConfig
function, but not implemented inside plugin generator.
https://github.com/tetratelabs/wazero/blob/e2ebce5d230eceff7d89e4d8677a166dd9ebabca/config.go#L450-L454
Tested with following code, and seems to working fine
// Combine the above into our baseline config, overriding defaults.
fsc := wazero.NewFSConfig().WithDirMount("/home/dvolodin", "/")
config := wazero.NewModuleConfig().
// By default, I/O streams are discarded and there's no file system.
WithStdout(opt.Stdout).WithStderr(opt.Stderr).WithFSConfig(fsc)
So, I guess what we need to do here is to generate code to allow moduleconfig or config for the runtime itself. maybe like this? https://github.com/http-wasm/http-wasm-host-go/blob/main/handler/options.go#L14-L23
In the example here it is outlined that the host can pass an embedded FS to the plugin and the plugin will only be able to access content within that embedded filesystem.
Is it possible to "pass" a filesystem the other way - i.e from plugin to host?
I have embedded some assets in the plugin with
embed.FS
and I want the host to be able to access those. Is there a way to expose the FS to the host?