blob: a4cb7877ca4493baa5e93c706699285c234f01e6 (
plain) (
tree)
|
|
use anyhow::Result;
use futures::future::try_join_all;
use log::*;
use crate::consul_actor::ConsulActor;
use crate::environment::Environment;
pub struct Diplonat {
consul: ConsulActor
}
impl Diplonat {
pub async fn new() -> Result<Self> {
let env = Environment::new()?;
let ctx = Self {
consul: ConsulActor::new(&env.consul_url, &env.consul_node_name)
};
return Ok(ctx);
}
pub async fn listen(&mut self) -> Result<()> {
try_join_all(vec![
self.consul.listen()
]).await?;
return Ok(());
}
}
|