You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(plugin/runner): Support pluginEnvVars (#10318)
**Description:**
> Currently, `WasiEnvBuilder` clones a lot to pass environment variables
to Wasm. I think it should get environment variables from the host
dynamically. Any plan to support it?
_Originally posted by @kdy1 in
[#9668](#9668 (comment)
I think this is possible, we can manually add envs to `WasiEnvBuilder`
by `add_env`. So I finsh a rough implementation. More suggestions are
welcome.
.swcrc
```json
{
"jsc": {
"experimental": {
"plugins": [["./my_first_plugin.wasm", {}]],
"pluginEnvVars": ["BUILD_REPOSITORY_NAME"]
}
}
}
```
plugin.rs
```rs
#[plugin_transform]
pub fn process_transform(program: Program, _metadata: TransformPluginProgramMetadata) -> Program {
for env in std::env::vars() {
println!("{}: {}", env.0, env.1);
}
program
}
```
**Related issue:**
- Closes#9668
0 commit comments