Simple notification http server

make host and port configurable through HOST and PORT

vielle.dev efe3cd91 22820805

verified
Changed files
+11 -1
src
+11 -1
src/main.rs
··· 25 25 26 26 #[actix_web::main] 27 27 async fn main() -> std::io::Result<()> { 28 + let host = std::env::var("HOST").unwrap_or(String::from("127.0.0.1")); 29 + let port = std::env::var("PORT") 30 + .map(|x| x.parse::<u16>().unwrap_or(60000)) 31 + .unwrap_or(60000); 32 + 33 + println!( 34 + "Starting http server on POST http://{}:{}/notify", 35 + host, port 36 + ); 37 + 28 38 HttpServer::new(|| App::new().service(notify)) 29 - .bind(("127.0.0.1", 3000))? 39 + .bind((host, port))? 30 40 .run() 31 41 .await 32 42 }