diff options
author | Cara Salter <cara@devcara.com> | 2022-04-28 14:55:39 -0400 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2022-04-28 14:56:21 -0400 |
commit | 7f1fc0444f8ae7a4c1263881a151eb3d2991bbb8 (patch) | |
tree | e2114313871caa7b37da7097f5e7911f944d4235 /src | |
parent | bc3132f22f3470d8b1d8189e23393d3bb4577480 (diff) | |
download | solard-7f1fc0444f8ae7a4c1263881a151eb3d2991bbb8.tar.gz solard-7f1fc0444f8ae7a4c1263881a151eb3d2991bbb8.zip |
main: Make bind address an environment variable
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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) |