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

Function gateway_use

crates/openshell-cli/src/run.rs:586–602  ·  view source on GitHub ↗

Set the active gateway.

(name: &str)

Source from the content-addressed store, hash-verified

584
585/// Set the active gateway.
586pub fn gateway_use(name: &str) -> Result<()> {
587 // Verify the gateway exists
588 get_gateway_metadata(name).ok_or_else(|| {
589 miette::miette!(
590 "No gateway metadata found for '{name}'.\n\
591 Register it first with: openshell gateway add <endpoint> --name {name}\n\
592 Or list available gateways: openshell gateway select"
593 )
594 })?;
595
596 save_active_gateway(name)?;
597 eprintln!("{} Active gateway set to '{name}'", "✓".green().bold());
598 if let Some(warning) = gateway_env_override_warning(name) {
599 eprintln!("{} {warning}", "⚠".yellow().bold());
600 }
601 Ok(())
602}
603
604fn gateway_env_override_warning(selected_name: &str) -> Option<String> {
605 let env_name = std::env::var("OPENSHELL_GATEWAY").ok()?;

Callers 1

gateway_select_withFunction · 0.85

Calls 3

get_gateway_metadataFunction · 0.85
save_active_gatewayFunction · 0.85

Tested by

no test coverage detected