From efe3cd9189780be868a32ae8bb433d5584b969ca Mon Sep 17 00:00:00 2001 From: afterlifepro Date: Sun, 23 Nov 2025 00:44:01 +0000 Subject: [PATCH] make host and port configurable through HOST and PORT --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index bf61f11..b32b8db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,8 +25,18 @@ async fn notify(notification: web::Form) -> impl Responder { #[actix_web::main] async fn main() -> std::io::Result<()> { + let host = std::env::var("HOST").unwrap_or(String::from("127.0.0.1")); + let port = std::env::var("PORT") + .map(|x| x.parse::().unwrap_or(60000)) + .unwrap_or(60000); + + println!( + "Starting http server on POST http://{}:{}/notify", + host, port + ); + HttpServer::new(|| App::new().service(notify)) - .bind(("127.0.0.1", 3000))? + .bind((host, port))? .run() .await } -- 2.51.2