Collect `(server_host, identity)` pairs from the global config — both the default `[server]` block and every named `[servers.*]` profile — that declare an identity. Servers without an identity binding are skipped. Returns an empty list when no config exists or it can't be read, so resolution degrades cleanly to URL-based inference.
()
| 63 | /// Returns an empty list when no config exists or it can't be read, so |
| 64 | /// resolution degrades cleanly to URL-based inference. |
| 65 | fn configured_server_identities() -> Vec<(String, String)> { |
| 66 | let config = match atomic_config::GlobalConfig::load() { |
| 67 | Ok(c) => c, |
| 68 | Err(e) => { |
| 69 | log::debug!("Could not load global config for server identities: {e}"); |
| 70 | return Vec::new(); |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | let mut pairs = Vec::new(); |
| 75 | let mut consider = |server: &atomic_config::ServerConfig| { |
| 76 | if let (Some(url), Some(identity)) = (server.url.as_ref(), server.identity.as_ref()) { |
| 77 | if let Some(host) = Url::parse(url) |
| 78 | .ok() |
| 79 | .and_then(|u| u.host_str().map(String::from)) |
| 80 | { |
| 81 | pairs.push((host, identity.clone())); |
| 82 | } |
| 83 | } |
| 84 | }; |
| 85 | |
| 86 | consider(&config.server); |
| 87 | for server in config.servers.values() { |
| 88 | consider(server); |
| 89 | } |
| 90 | pairs |
| 91 | } |
| 92 | |
| 93 | /// Pure identity resolution from a URL plus the configured server bindings. |
| 94 | /// |
no test coverage detected