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

Function find_gateway_by_endpoint

crates/openshell-cli/src/main.rs:62–76  ·  view source on GitHub ↗
(endpoint: &str)

Source from the content-addressed store, hash-verified

60}
61
62fn find_gateway_by_endpoint(endpoint: &str) -> Option<String> {
63 let endpoint = normalize_gateway_endpoint(endpoint);
64
65 if let Some(active_name) = load_active_gateway()
66 && let Ok(metadata) = load_gateway_metadata(&active_name)
67 && normalize_gateway_endpoint(&metadata.gateway_endpoint) == endpoint
68 {
69 return Some(metadata.name);
70 }
71
72 list_gateways().ok()?.into_iter().find_map(|metadata| {
73 (normalize_gateway_endpoint(&metadata.gateway_endpoint) == endpoint)
74 .then_some(metadata.name)
75 })
76}
77
78fn resolve_gateway(
79 gateway_flag: &Option<String>,

Callers 1

resolve_gatewayFunction · 0.85

Calls 4

load_active_gatewayFunction · 0.85
load_gateway_metadataFunction · 0.85
list_gatewaysFunction · 0.85

Tested by

no test coverage detected