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.
()
| 56 | /// Returns an empty list when no config exists or it can't be read, so |
| 57 | /// resolution degrades cleanly to URL-based inference. |
| 58 | fn configured_server_identities() -> Vec<(String, String)> { |
| 59 | let config = match atomic_config::GlobalConfig::load() { |
| 60 | Ok(c) => c, |
| 61 | Err(e) => { |
| 62 | log::debug!("Could not load global config for server identities: {e}"); |
| 63 | return Vec::new(); |
| 64 | } |
| 65 | }; |
| 66 | |
| 67 | let mut pairs = Vec::new(); |
| 68 | let mut consider = |server: &atomic_config::ServerConfig| { |
| 69 | if let (Some(url), Some(identity)) = (server.url.as_ref(), server.identity.as_ref()) { |
| 70 | if let Some(host) = Url::parse(url) |
| 71 | .ok() |
| 72 | .and_then(|u| u.host_str().map(String::from)) |
| 73 | { |
| 74 | pairs.push((host, identity.clone())); |
| 75 | } |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | consider(&config.server); |
| 80 | for server in config.servers.values() { |
| 81 | consider(server); |
| 82 | } |
| 83 | pairs |
| 84 | } |
| 85 | |
| 86 | /// Pure identity resolution from a URL plus the configured server bindings. |
| 87 | /// |
no test coverage detected