ddns_core/
lib.rs

1//! ddns-core – high-level orchestration
2
3pub mod cfg;
4pub mod detector;
5pub mod error;
6mod http;
7pub mod scheduler;
8pub mod status;
9
10use anyhow::Result;
11use cfg::AppConfig;
12use status::{Event, SharedStatus};
13
14/// Launches HTTP dashboard and scheduler concurrently.
15pub async fn bootstrap(cfg: AppConfig) -> Result<()> {
16    let shared: SharedStatus = Default::default();
17    let (tx, _rx) = tokio::sync::broadcast::channel::<Event>(1024);
18
19    let http_cfg = cfg.http.clone();
20
21    let http_handle = tokio::spawn(http::run_http_server(shared.clone(), tx.clone(), http_cfg));
22    let sched_handle = tokio::spawn(scheduler::run_scheduler(cfg, shared, tx));
23
24    sched_handle.await??;
25    http_handle.await??;
26    Ok(())
27}
28
29pub use cfg::load_config;