feat: allow bind_address to be modified with env var

This commit is contained in:
Strix 2023-10-16 01:36:01 +02:00
parent 43d05fadc4
commit 9ef5feafc7
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774

View file

@ -1,5 +1,6 @@
use std::env;
use actix_files as fs; use actix_files as fs;
use actix_web::{App, HttpServer, middleware}; use actix_web::{App, HttpServer, middleware, web};
use env_logger; use env_logger;
mod relay; mod relay;
@ -17,7 +18,7 @@ async fn main() -> std::io::Result<()> {
.index_file("index.html") .index_file("index.html")
) )
}) })
.bind(("0.0.0.0", 8080))? .bind(env::var("BIND_ADDRESS").unwrap_or(String::from("0.0.0.0:8080")))?
.run() .run()
.await .await
} }