Fix listen host

This commit is contained in:
Pierre HUBERT 2024-08-22 08:59:31 +02:00
parent 7dccdf58fa
commit b52fbca4fd

View File

@ -21,6 +21,9 @@ struct Args {
/// Maximal port this server will listen to /// Maximal port this server will listen to
#[arg(short('M'), long, default_value_t = 1000)] #[arg(short('M'), long, default_value_t = 1000)]
max_port: u16, max_port: u16,
/// Host this server will listen to
#[arg(short, long, default_value="0.0.0.0")]
listen_host: String,
} }
#[actix_web::main] #[actix_web::main]
@ -47,7 +50,7 @@ async fn main() -> std::io::Result<()> {
.wrap(Logger::default()) .wrap(Logger::default())
.route("/", web::get().to(home)) .route("/", web::get().to(home))
}) })
.bind(("127.0.0.1", port))? .bind((args.listen_host, port))?
.run() .run()
.await .await
} }