allow changing the port
All checks were successful
Build / build (push) Successful in 2m31s

This commit is contained in:
Max Känner 2025-01-25 23:55:56 +01:00
parent 6f04d7cb7f
commit d715aa47b3

View File

@ -1,3 +1,5 @@
use std::env;
use axum::{
extract::Json,
response,
@ -30,7 +32,8 @@ async fn main() {
.route("/end", post(end));
debug!("Creating listener");
let listener = TcpListener::bind("0.0.0.0:8000").await.unwrap();
let port = env::var("PORT").unwrap_or_else(|_| "8000".into());
let listener = TcpListener::bind(format!("0.0.0.0:{port}")).await.unwrap();
debug!("Starting server");
axum::serve(listener, app).await.unwrap();
}