generated from PlexSheep/rs-base
refactor(cli): simplify the cli, starting admin and all channenges
cargo devel CI / cargo CI (push) Successful in 1m55s
Details
cargo devel CI / cargo CI (push) Successful in 1m55s
Details
no challenge id in cli anymore, give a base addr for the challenges and an admin addr
This commit is contained in:
parent
257ba9820b
commit
049421ffac
|
@ -46,13 +46,14 @@ pub const ENV_SECRET: &str = "WOOLY_SECRET";
|
|||
long_about,
|
||||
help_template = libpt::cli::args::HELP_TEMPLATE)]
|
||||
pub struct Config {
|
||||
/// Index of the challenge
|
||||
pub challenge: u16,
|
||||
/// Network address to host the challenge on
|
||||
/// Network address to host the challenges on
|
||||
///
|
||||
/// The port will be the port for challenge 0. Challenge 1 will be hosted on port+1 and so on.
|
||||
#[arg(short = 'c', long = "challenge")]
|
||||
pub addr: SocketAddr,
|
||||
/// Network address to host the challenge on
|
||||
/// Network address to host the admin interface on
|
||||
#[arg(short = 'a', long = "admin")]
|
||||
pub addr_admin: Option<SocketAddr>,
|
||||
pub addr_admin: SocketAddr,
|
||||
#[command(flatten)]
|
||||
pub verbosity: VerbosityLevel,
|
||||
}
|
||||
|
@ -60,10 +61,9 @@ pub struct Config {
|
|||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
challenge: 1,
|
||||
addr: SocketAddr::from_str("127.0.0.1:1337").unwrap(),
|
||||
verbosity: VerbosityLevel::default(),
|
||||
addr_admin: Option::default(),
|
||||
addr_admin: SocketAddr::from_str("127.0.0.1:8080").unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,7 @@ pub async fn serve(challenges: Vec<(ChallengeDesc, VaultRef)>, config: Config) -
|
|||
)
|
||||
}));
|
||||
|
||||
warp::serve(routes)
|
||||
.run(service.config.addr_admin.unwrap())
|
||||
.await;
|
||||
warp::serve(routes).run(service.config.addr_admin).await;
|
||||
|
||||
warn!("exited the admin interface");
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in New Issue