diff --git a/broker/src/main.rs b/broker/src/main.rs index dc3c703..a1a2526 100644 --- a/broker/src/main.rs +++ b/broker/src/main.rs @@ -127,5 +127,5 @@ async fn run_main(parent_fd: i32) -> rocket::Rocket { signer_loop.start(Some(settings)); }); - routes::launch_rocket(tx, error_tx) + routes::launch_rocket(tx, error_tx, settings) } diff --git a/broker/src/routes.rs b/broker/src/routes.rs index fc64d29..42eabc0 100644 --- a/broker/src/routes.rs +++ b/broker/src/routes.rs @@ -1,3 +1,4 @@ +use crate::util::Settings; use crate::ChannelRequest; use rocket::fairing::{Fairing, Info, Kind}; use rocket::http::Header; @@ -6,6 +7,8 @@ use rocket::response::stream::{EventStream, Event}; use rocket::tokio::select; use rocket::*; use sphinx_key_parser::{topics, error::Error as ParserError}; +use std::net::IpAddr::V4; +use std::net::Ipv4Addr; pub type Result = std::result::Result; @@ -43,8 +46,14 @@ async fn errors(error_tx: &State>>, mut end: Shutdown) } } -pub fn launch_rocket(tx: Sender, error_tx: broadcast::Sender>) -> Rocket { +pub fn launch_rocket(tx: Sender, error_tx: broadcast::Sender>, settings: Settings) -> Rocket { + let config = Config { + address: V4(Ipv4Addr::UNSPECIFIED), + port: settings.http_port, + ..Config::debug_default() + }; rocket::build() + .configure(config) .mount("/api/", routes![control, errors]) .attach(CORS) .manage(tx) diff --git a/broker/src/run_test.rs b/broker/src/run_test.rs index e4b83ef..8ad12c8 100644 --- a/broker/src/run_test.rs +++ b/broker/src/run_test.rs @@ -50,7 +50,7 @@ pub async fn run_test() -> rocket::Rocket { }; } }); - launch_rocket(tx, error_tx) + launch_rocket(tx, error_tx, settings) } #[allow(dead_code)]