Configures the environment variables available to wasm, specified here as a list of pairs where the first element of the pair is the key and the second element is the value.
| 45 | /// a list of pairs where the first element of the pair is the key and the |
| 46 | /// second element is the value. |
| 47 | void env(const std::vector<std::pair<std::string, std::string>> &env) { |
| 48 | std::vector<const char *> names; |
| 49 | std::vector<const char *> values; |
| 50 | for (const auto &[name, value] : env) { |
| 51 | names.push_back(name.c_str()); |
| 52 | values.push_back(value.c_str()); |
| 53 | } |
| 54 | wasi_config_set_env(ptr.get(), env.size(), names.data(), values.data()); |
| 55 | } |
| 56 | |
| 57 | /// Indicates that the entire environment of this process should be inherited |
| 58 | /// by the wasi configuration. |