Open
Description
wagi --env
is good for global env vars for all modules, but for some cases, I need to inject some secret vars for a Wasm module only, not for all modules. I found the example from https://github.com/deislabs/wagi-examples/tree/main/env_wagi
[[module]]
# Mount this to example.com/env
route = "/env"
# Point to the directory that 'cargo build' wrote the WASM file
module = "/path/to/env_wagi/target/wasm32-wasi/release/env_wagi.wasm"
# Mount the source code of this repo
volumes = { "/" = "/path/to/env_wagi" }
# Set an environment variable
environment.TEST_NAME = "test value"
But it does not work on 0.3.0, any clue?
pub struct Module {
/// The route, begining with a leading slash.
///
/// The suffix "/..." means "this route and all sub-paths". For example, the route
/// "/foo/..." will match "/foo" as well as "/foo/bar" and "/foo/bar/baz"
pub route: String,
/// The path to the module that will be loaded.
///
/// This should be an absolute path. It must point to a WASM+WASI 32-bit program
/// with the read bit set.
pub module: String,
/// Directories on the local filesystem that can be opened by this module
/// The key (left value) is the name of the directory INSIDE the WASM. The value is
/// the location OUTSIDE the WASM. Two inside locations can map to the same outside
/// location.
pub volumes: Option<HashMap<String, String>>,
/// The name of the function that is the entrypoint for executing the module.
/// The default is `_start`.
pub entrypoint: Option<String>,
/// The URL fragment for the bindle server.
///
/// If none is supplied, then http://localhost:8080/v1 is used
pub bindle_server: Option<String>,
/// List of hosts that the guest module is allowed to make HTTP requests to.
/// If none or an empty vector is supplied, the guest module cannot send
/// requests to any server.
pub allowed_hosts: Option<Vec<String>>,
/// Max http concurrency that the guest module configures for the HTTP
/// client. If none, the guest module uses the default concurrency provided
/// by the WASM HTTP client module.
pub http_max_concurrency: Option<u32>,
}
Metadata
Metadata
Assignees
Labels
No labels