diff --git a/battlesnake/src/main.rs b/battlesnake/src/main.rs index a806d24..4873392 100644 --- a/battlesnake/src/main.rs +++ b/battlesnake/src/main.rs @@ -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(); }