MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / upsert_env

Function upsert_env

crates/openshell-driver-kubernetes/src/driver.rs:2079–2089  ·  view source on GitHub ↗
(env: &mut Vec<serde_json::Value>, name: &str, value: &str)

Source from the content-addressed store, hash-verified

2077}
2078
2079fn upsert_env(env: &mut Vec<serde_json::Value>, name: &str, value: &str) {
2080 if let Some(existing) = env
2081 .iter_mut()
2082 .find(|item| item.get("name").and_then(|value| value.as_str()) == Some(name))
2083 {
2084 *existing = serde_json::json!({"name": name, "value": value});
2085 return;
2086 }
2087
2088 env.push(serde_json::json!({"name": name, "value": value}));
2089}
2090
2091/// Extract a string value from the template's `platform_config` Struct.
2092fn platform_config_string(template: &SandboxTemplate, key: &str) -> Option<String> {

Callers 3

build_env_listFunction · 0.85
apply_env_mapFunction · 0.85
apply_required_envFunction · 0.85

Calls 3

pushMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected