mod captcha_solutions; mod config; mod context; mod forms; mod mailer; mod routes; use anyhow::Result; use rocket::{Build, Rocket}; use rocket_dyn_templates::Template; use std::process; fn init() -> Result> { let mut config = config::Config::new()?; let rocket = rocket::build() .mount( &config.path_prefix, rocket::routes![routes::index, routes::submit, routes::success], ) .manage(captcha_solutions::SharedCaptchaSolutions::new()) .manage(mailer::Mailer::new(&mut config)?) .manage(config) .attach(Template::fairing()); Ok(rocket) } #[rocket::launch] fn rocket() -> _ { init().unwrap_or_else(|e| { eprintln!("{e}"); process::exit(1); }) }