veloren/server-cli/src/admin.rs
Imbris 8d0b776f18 Move server-cli commands to separate file, tracy profiling par_join improvements, misc improvements
- remove overwritten logging setting in server-cli
- add server-cli command to load a random area for testing without a client
- make admin add/remove commands modify ingame players instead of needing to reconnect
- add spans to par_join jobs
- added test command that loads up an area of the world
- add tracy-world-server alias
- set debug directives to info for logging
2021-03-13 02:28:59 -05:00

35 lines
1.1 KiB
Rust

use std::sync::Arc;
use tokio::runtime::Runtime;
pub fn admin_subcommand(
runtime: Arc<Runtime>,
sub_m: &clap::ArgMatches,
server_settings: &server::Settings,
editable_settings: &mut server::EditableSettings,
data_dir: &std::path::Path,
) {
let login_provider = server::login_provider::LoginProvider::new(
server_settings.auth_server_address.clone(),
runtime,
);
match sub_m.subcommand() {
("add", Some(sub_m)) => {
if let Some(username) = sub_m.value_of("username") {
server::add_admin(username, &login_provider, editable_settings, data_dir);
}
},
("remove", Some(sub_m)) => {
if let Some(username) = sub_m.value_of("username") {
server::remove_admin(username, &login_provider, editable_settings, data_dir);
}
},
// TODO: can clap enforce this?
// or make this list current admins or something
_ => tracing::error!(
"Invalid input, use one of the subcommands listed using: \nveloren-server-cli help \
admin"
),
}
}