diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-17 18:23:24 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-17 18:23:24 +0200 |
commit | e5cb04208f2287f5ba4f0f70367c0f8190e0082e (patch) | |
tree | 3812d20afa3bcde1b506ecefa66bc940f816ff7f | |
parent | 09c543eee3dbc361627e4ad6b5f5f55317ff334b (diff) | |
download | planetwars.dev-e5cb04208f2287f5ba4f0f70367c0f8190e0082e.tar.xz planetwars.dev-e5cb04208f2287f5ba4f0f70367c0f8190e0082e.zip |
allow disabling ranker in develpoment
-rw-r--r-- | planetwars-server/configuration.toml | 2 | ||||
-rw-r--r-- | planetwars-server/src/lib.rs | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/planetwars-server/configuration.toml b/planetwars-server/configuration.toml index 721aca1..13012f9 100644 --- a/planetwars-server/configuration.toml +++ b/planetwars-server/configuration.toml @@ -9,3 +9,5 @@ maps_directory = "./data/maps" registry_directory = "./data/registry" registry_admin_password ="verysecretadminpassword" + +ranker_enabled = false diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 8962c3e..7bc50f3 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -8,10 +8,10 @@ pub mod routes; pub mod schema; pub mod util; -use std::path::PathBuf; -use std::{net::SocketAddr, fs}; use std::ops::Deref; +use std::path::PathBuf; use std::sync::Arc; +use std::{fs, net::SocketAddr}; use bb8::{Pool, PooledConnection}; use bb8_diesel::{self, DieselConnectionManager}; @@ -56,6 +56,9 @@ pub struct GlobalConfig { /// secret admin password for internal docker login /// used to pull bots when running matches pub registry_admin_password: String, + + /// Whether to run the ranker + pub ranker_enabled: bool, } // TODO: do we still need this? Is there a better way? @@ -161,7 +164,9 @@ pub async fn run_app() { let db_pool = prepare_db(&global_config).await; init_directories(&global_config).unwrap(); - tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); + if global_config.ranker_enabled { + tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); + } tokio::spawn(run_registry(global_config.clone(), db_pool.clone())); let api_service = Router::new() |