LINE1 10 20 30 40 50 60 70 80 901use std::env;23use actix_web::{App, HttpServer, web};45#[actix_web::main]6asyncfnmain() -> std::io::Result<()> {7let db_path = env::var("DIAL_DB").unwrap_or_else(|_| "dial.db".to_string());8let bind = env::var("DIAL_BIND").unwrap_or_else(|_| "127.0.0.1:8080".to_string());9// Required: the broker refuses to start without a key rather than run open.10let api_key = env::var("DIAL_API_KEY")11 .ok()12 .filter(|key| !key.is_empty())13 .ok_or_else(|| std::io::Error::other("DIAL_API_KEY must be set to a non-empty value"))?;1415let db = dial::open(&db_path).map_err(std::io::Error::other)?;16let data = web::Data::new(db);17let key = web::Data::new(dial::ApiKey(api_key));1819println!("dial listening on {bind}, storing messages in {db_path}, API key required");20HttpServer::new(move || {21App::new()22 .app_data(data.clone())23 .app_data(key.clone())24 .configure(dial::configure)25 })26 .bind(bind)?27 .run()28 .await29}