From 66d2d636eeae7a1c21322e2a45e0c96a6f781ab2 Mon Sep 17 00:00:00 2001 From: Imbris Date: Sun, 20 Sep 2020 00:51:20 -0400 Subject: [PATCH] Add server-cli option to disable auth --- server-cli/src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index c0d7772aab..7723f1ec91 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -41,24 +41,26 @@ fn main() -> io::Result<()> { .version(common::util::DISPLAY_VERSION_LONG.as_str()) .author("The veloren devs ") .about("The veloren server cli provides an easy to use interface to start a veloren server") - .arg( + .args(&[ Arg::with_name("basic") .short("b") .long("basic") .help("Disables the tui") .takes_value(false), - ) - .arg( Arg::with_name("interactive") .short("i") .long("interactive") .help("Enables command input for basic mode") .takes_value(false), - ) + Arg::with_name("no-auth") + .long("no-auth") + .help("Runs without auth enabled"), + ]) .get_matches(); let basic = matches.is_present("basic"); let interactive = matches.is_present("interactive"); + let no_auth = matches.is_present("no-auth"); let sigusr1_signal = Arc::new(AtomicBool::new(false)); @@ -126,7 +128,12 @@ fn main() -> io::Result<()> { let mut clock = Clock::start(); // Load settings - let settings = ServerSettings::load(); + let mut settings = ServerSettings::load(); + // TODO: make settings file immutable so that this does not overwrite the + // settings + if no_auth { + settings.auth_server_address = None; + } let server_port = &settings.gameserver_address.port(); let metrics_port = &settings.metrics_address.port(); // Create server