#![deny(warnings)]
mod cron_jobs;
mod error;
mod filesystem;
mod middlewares;
mod openapi;
mod paths;
mod routes;
mod routine_storage;
mod routines;
mod storage;
mod sync;
mod utils;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
routines::ensure_default_agents();
let store = storage::load_store();
let routines = routine_storage::load_store();
if let Err(e) = sync::routines::sync_routines_to_crontab(&routines) {
log::warn!("startup crontab sync failed: {e}");
}
let listener = tokio::net::TcpListener::bind("127.0.0.1:5784").await?;
routes::http::run_with_listener_until(store, routines, listener, std::future::pending()).await
}