This returns the (first) region-name, based on the given common-name. This function is used for roaming, as within the context of roaming, only the common-name is given by the other party.
(common_name: region::CommonName)
| 89 | /// This function is used for roaming, as within the context of roaming, only |
| 90 | /// the common-name is given by the other party. |
| 91 | pub fn get_region_config_id(common_name: region::CommonName) -> Result<String> { |
| 92 | let regions_r = REGIONS.read().unwrap(); |
| 93 | for (k, v) in &*regions_r { |
| 94 | if v.get_name() == common_name { |
| 95 | return Ok(k.clone()); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | Err(anyhow!( |
| 100 | "No region configured with common-name: {}", |
| 101 | common_name |
| 102 | )) |
| 103 | } |
no test coverage detected