(
existing_env: Option<&Vec<serde_json::Value>>,
template_environment: &std::collections::HashMap<String, String>,
spec_environment: &std::collections::HashMap<String, String>,
sandbox
| 1949 | |
| 1950 | #[allow(clippy::too_many_arguments)] |
| 1951 | fn build_env_list( |
| 1952 | existing_env: Option<&Vec<serde_json::Value>>, |
| 1953 | template_environment: &std::collections::HashMap<String, String>, |
| 1954 | spec_environment: &std::collections::HashMap<String, String>, |
| 1955 | sandbox_id: &str, |
| 1956 | sandbox_name: &str, |
| 1957 | grpc_endpoint: &str, |
| 1958 | ssh_socket_path: &str, |
| 1959 | tls_enabled: bool, |
| 1960 | provider_spiffe_socket_path: Option<&str>, |
| 1961 | ) -> Vec<serde_json::Value> { |
| 1962 | let mut env = existing_env.cloned().unwrap_or_default(); |
| 1963 | apply_env_map(&mut env, template_environment); |
| 1964 | apply_env_map(&mut env, spec_environment); |
| 1965 | let mut user_env = template_environment.clone(); |
| 1966 | user_env.extend(spec_environment.clone()); |
| 1967 | if !user_env.is_empty() |
| 1968 | && let Ok(json) = serde_json::to_string(&user_env) |
| 1969 | { |
| 1970 | upsert_env( |
| 1971 | &mut env, |
| 1972 | openshell_core::sandbox_env::USER_ENVIRONMENT, |
| 1973 | &json, |
| 1974 | ); |
| 1975 | } |
| 1976 | apply_required_env( |
| 1977 | &mut env, |
| 1978 | sandbox_id, |
| 1979 | sandbox_name, |
| 1980 | grpc_endpoint, |
| 1981 | ssh_socket_path, |
| 1982 | tls_enabled, |
| 1983 | provider_spiffe_socket_path, |
| 1984 | ); |
| 1985 | env |
| 1986 | } |
| 1987 | |
| 1988 | fn apply_env_map( |
| 1989 | env: &mut Vec<serde_json::Value>, |
no test coverage detected