(env: &mut Vec<serde_json::Value>, name: &str, value: &str)
| 2077 | } |
| 2078 | |
| 2079 | fn 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. |
| 2092 | fn platform_config_string(template: &SandboxTemplate, key: &str) -> Option<String> { |
no test coverage detected