churn-v2/crates/churn/src/agent/discovery_client.rs
kjuulh ee323e99e8
All checks were successful
continuous-integration/drone/push Build is passing
feat: add discovery
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-11-24 17:12:15 +01:00

22 lines
517 B
Rust

use crate::api::Discovery;
pub struct DiscoveryClient {
host: String,
}
impl DiscoveryClient {
pub fn new(discovery_host: impl Into<String>) -> Self {
Self {
host: discovery_host.into(),
}
}
pub async fn discover(&self) -> anyhow::Result<Discovery> {
tracing::info!(
"getting details from discovery endpoint: {}/discovery",
self.host.trim_end_matches('/')
);
crate::api::Discovery::get_from_host(&self.host).await
}
}