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

Function endpoint_url

crates/openshell-server/src/service_routing.rs:49–63  ·  view source on GitHub ↗
(
    config: &openshell_core::Config,
    sandbox: &str,
    service: &str,
)

Source from the content-addressed store, hash-verified

47}
48
49pub fn endpoint_url(
50 config: &openshell_core::Config,
51 sandbox: &str,
52 service: &str,
53) -> Option<String> {
54 let host = endpoint_host(&config.service_routing, sandbox, service)?;
55 let scheme = endpoint_scheme(config);
56 let port = config.bind_address.port();
57 let include_port = !matches!((scheme, port), ("https", 443) | ("http", 80));
58 Some(if include_port {
59 format!("{scheme}://{host}:{port}/")
60 } else {
61 format!("{scheme}://{host}/")
62 })
63}
64
65fn endpoint_scheme(config: &openshell_core::Config) -> &'static str {
66 if config.tls.is_none()

Callers 2

handle_expose_serviceFunction · 0.85

Calls 2

endpoint_hostFunction · 0.85
endpoint_schemeFunction · 0.85

Tested by

no test coverage detected