Use the listen port set in the env vars

This commit is contained in:
Sofía Aritz 2024-10-15 23:02:14 +02:00
parent 39163ab050
commit e48f74b970
Signed by: sofia
GPG key ID: 90B5116E3542B28F

View file

@ -17,7 +17,7 @@
use axum::{extract::{MatchedPath, Request}, response::Response, routing::get, Router}; use axum::{extract::{MatchedPath, Request}, response::Response, routing::get, Router};
use database::create_connection_pool; use database::create_connection_pool;
use diesel::{r2d2::ConnectionManager, SqliteConnection}; use diesel::{r2d2::ConnectionManager, SqliteConnection};
use env::LoadEnvError; use env::{listen_port, LoadEnvError};
use http::routes::auth::auth_router; use http::routes::auth::auth_router;
use r2d2::Pool; use r2d2::Pool;
use tower_http::{classify::ServerErrorsFailureClass, trace::TraceLayer}; use tower_http::{classify::ServerErrorsFailureClass, trace::TraceLayer};
@ -101,7 +101,8 @@ async fn main() {
), ),
); );
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000") // FIXME(sofia): Add an env var to change the bind addr
let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", listen_port()))
.await .await
.expect("failed to bind"); .expect("failed to bind");