MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / resolve_identity_name_with_override

Function resolve_identity_name_with_override

atomic-cli/src/commands/auth.rs:49–57  ·  view source on GitHub ↗

Resolve the identity name to authenticate as. Priority: 1. An explicit override (the `--identity` flag). 2. URL userinfo (`http://bob@host/...`). 3. A configured server profile whose host is the longest dot-boundary suffix of the remote host (`[servers.prod] url=... identity=...`). This is the binding that makes pushes to *any* tenant under a server you've registered with ("just works" without `-

(
    remote_url: &str,
    identity_override: Option<&str>,
)

Source from the content-addressed store, hash-verified

47/// Returns `None` only when there is no override and nothing inferable from the
48/// URL or config.
49fn resolve_identity_name_with_override(
50 remote_url: &str,
51 identity_override: Option<&str>,
52) -> Option<String> {
53 if let Some(name) = identity_override {
54 return Some(name.to_string());
55 }
56 resolve_identity_from_url(remote_url, &configured_server_identities())
57}
58
59/// Collect `(server_host, identity)` pairs from the global config — both the
60/// default `[server]` block and every named `[servers.*]` profile — that

Calls 2