2024-11-24 00:53:43 +01:00
|
|
|
use agent_state::AgentState;
|
2024-11-24 17:12:15 +01:00
|
|
|
use event_handler::EventHandler;
|
2024-11-24 00:53:43 +01:00
|
|
|
use refresh::AgentRefresh;
|
2024-11-24 01:34:06 +01:00
|
|
|
|
2024-11-24 17:12:15 +01:00
|
|
|
pub use config::setup_config;
|
2024-11-24 01:34:06 +01:00
|
|
|
|
2024-11-24 17:12:15 +01:00
|
|
|
mod agent_state;
|
|
|
|
mod config;
|
|
|
|
mod discovery_client;
|
|
|
|
mod event_handler;
|
|
|
|
mod grpc_client;
|
|
|
|
mod refresh;
|
2024-11-24 00:53:43 +01:00
|
|
|
|
2024-11-24 17:12:15 +01:00
|
|
|
pub async fn execute() -> anyhow::Result<()> {
|
2024-11-24 00:53:43 +01:00
|
|
|
let state = AgentState::new().await?;
|
|
|
|
|
|
|
|
notmad::Mad::builder()
|
2024-11-24 17:12:15 +01:00
|
|
|
.add(AgentRefresh::new(&state))
|
|
|
|
.add(EventHandler::new(&state))
|
2024-11-24 00:53:43 +01:00
|
|
|
.cancellation(Some(std::time::Duration::from_secs(2)))
|
|
|
|
.run()
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|