From 7f1fc0444f8ae7a4c1263881a151eb3d2991bbb8 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Thu, 28 Apr 2022 14:55:39 -0400 Subject: main: Make bind address an environment variable --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index d2f83a4..ba319d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use axum::{ }; use serde::{Deserialize, Serialize}; -use std::{net::SocketAddr, time::Duration}; +use std::{net::SocketAddr, time::Duration, str::FromStr}; use tower::{BoxError, ServiceBuilder}; use tower_http::trace::TraceLayer; @@ -49,7 +49,7 @@ async fn main() { .into_inner(), ); - let addr = SocketAddr::from(([127,0,0,1], 3000)); + let addr = SocketAddr::from_str(std::env::var("BIND_ADDR").unwrap().as_str().into()).unwrap(); tracing::info!("Listening on {}", addr); axum::Server::bind(&addr) -- cgit v1.2.3