dotfiles/agent/src/main.rs
Nikos Papadakis 46b87d2559
more churn
2024-01-29 20:18:29 +02:00

38 lines
931 B
Rust

use health::init_health_subsystem;
use messaging::Client;
use services::init_services;
use tracing::Level;
mod health;
mod messaging;
mod pty;
mod services;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let subscriber = tracing_subscriber::fmt()
.with_max_level(Level::TRACE)
.finish();
tracing::subscriber::set_global_default(subscriber)
.expect("to set a tracing global subscriber");
run().await.map_err(|err| {
tracing::error!(cause = %err, "could not start agent");
err
})
}
async fn run() -> anyhow::Result<()> {
let client = Client::connect("demo_agent").await?;
let _health_monitor = init_health_subsystem(client.clone()).await;
tracing::info!("initialized health system");
init_services(client).await?;
tracing::info!("initialized services");
tracing::info!("agent is ready");
tokio::signal::ctrl_c().await?;
Ok(())
}