diff options
Diffstat (limited to 'src/consul.rs')
-rw-r--r-- | src/consul.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/consul.rs b/src/consul.rs index 14df1ee..cba435a 100644 --- a/src/consul.rs +++ b/src/consul.rs @@ -23,6 +23,8 @@ pub struct ConsulNode { pub node: String, #[serde(rename = "Address")] pub address: String, + #[serde(rename = "Meta")] + pub meta: HashMap<String, String>, } #[derive(Serialize, Deserialize, Debug)] @@ -117,14 +119,14 @@ impl Consul { }) } - pub async fn list_nodes(&self) -> Result<Vec<String>> { + pub async fn list_nodes(&self) -> Result<Vec<ConsulNode>> { debug!("list_nodes"); let url = format!("{}/v1/catalog/nodes", self.url); let http = self.client.get(&url).send().await?; let resp: Vec<ConsulNode> = http.json().await?; - Ok(resp.into_iter().map(|n| n.node).collect::<Vec<_>>()) + Ok(resp) } pub async fn watch_node( |