mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-20 16:54:32 +01:00
broker: set rocket server port to http_setting
This commit is contained in:
@@ -127,5 +127,5 @@ async fn run_main(parent_fd: i32) -> rocket::Rocket<rocket::Build> {
|
|||||||
signer_loop.start(Some(settings));
|
signer_loop.start(Some(settings));
|
||||||
});
|
});
|
||||||
|
|
||||||
routes::launch_rocket(tx, error_tx)
|
routes::launch_rocket(tx, error_tx, settings)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::util::Settings;
|
||||||
use crate::ChannelRequest;
|
use crate::ChannelRequest;
|
||||||
use rocket::fairing::{Fairing, Info, Kind};
|
use rocket::fairing::{Fairing, Info, Kind};
|
||||||
use rocket::http::Header;
|
use rocket::http::Header;
|
||||||
@@ -6,6 +7,8 @@ use rocket::response::stream::{EventStream, Event};
|
|||||||
use rocket::tokio::select;
|
use rocket::tokio::select;
|
||||||
use rocket::*;
|
use rocket::*;
|
||||||
use sphinx_key_parser::{topics, error::Error as ParserError};
|
use sphinx_key_parser::{topics, error::Error as ParserError};
|
||||||
|
use std::net::IpAddr::V4;
|
||||||
|
use std::net::Ipv4Addr;
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
@@ -43,8 +46,14 @@ async fn errors(error_tx: &State<broadcast::Sender<Vec<u8>>>, mut end: Shutdown)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn launch_rocket(tx: Sender<ChannelRequest>, error_tx: broadcast::Sender<Vec<u8>>) -> Rocket<Build> {
|
pub fn launch_rocket(tx: Sender<ChannelRequest>, error_tx: broadcast::Sender<Vec<u8>>, settings: Settings) -> Rocket<Build> {
|
||||||
|
let config = Config {
|
||||||
|
address: V4(Ipv4Addr::UNSPECIFIED),
|
||||||
|
port: settings.http_port,
|
||||||
|
..Config::debug_default()
|
||||||
|
};
|
||||||
rocket::build()
|
rocket::build()
|
||||||
|
.configure(config)
|
||||||
.mount("/api/", routes![control, errors])
|
.mount("/api/", routes![control, errors])
|
||||||
.attach(CORS)
|
.attach(CORS)
|
||||||
.manage(tx)
|
.manage(tx)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ pub async fn run_test() -> rocket::Rocket<rocket::Build> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
launch_rocket(tx, error_tx)
|
launch_rocket(tx, error_tx, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
Reference in New Issue
Block a user