aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/modules/matches.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-14 21:50:42 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-14 21:50:42 +0200
commitec5c91d37b46cb3cec4878176469c66d2304dadd (patch)
tree16b4dd13605d1a3349a4240f3b25b134af572c84 /planetwars-server/src/modules/matches.rs
parent00459f9e3d818f0fb84160862f02898d64f98110 (diff)
downloadplanetwars.dev-ec5c91d37b46cb3cec4878176469c66d2304dadd.tar.xz
planetwars.dev-ec5c91d37b46cb3cec4878176469c66d2304dadd.zip
change runnerconfig to globalconfig
Diffstat (limited to 'planetwars-server/src/modules/matches.rs')
-rw-r--r--planetwars-server/src/modules/matches.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/planetwars-server/src/modules/matches.rs b/planetwars-server/src/modules/matches.rs
index 07dc68b..dd5e523 100644
--- a/planetwars-server/src/modules/matches.rs
+++ b/planetwars-server/src/modules/matches.rs
@@ -11,19 +11,13 @@ use crate::{
matches::{MatchData, MatchResult},
},
util::gen_alphanumeric,
- ConnectionPool, BOTS_DIR, MAPS_DIR, MATCHES_DIR,
+ ConnectionPool, GlobalConfig, BOTS_DIR, MAPS_DIR, MATCHES_DIR,
};
-// TODO: add all paths
-pub struct MatchRunnerConfig {
- pub python_runner_image: String,
- pub container_registry_url: String,
-}
-
pub struct RunMatch {
log_file_name: String,
players: Vec<MatchPlayer>,
- runner_config: Arc<MatchRunnerConfig>,
+ runner_config: Arc<GlobalConfig>,
}
pub enum MatchPlayer {
@@ -37,7 +31,7 @@ pub enum MatchPlayer {
}
impl RunMatch {
- pub fn from_players(runner_config: Arc<MatchRunnerConfig>, players: Vec<MatchPlayer>) -> Self {
+ pub fn from_players(runner_config: Arc<GlobalConfig>, players: Vec<MatchPlayer>) -> Self {
let log_file_name = format!("{}.log", gen_alphanumeric(16));
RunMatch {
runner_config,
@@ -104,7 +98,7 @@ impl RunMatch {
}
pub fn bot_version_to_botspec(
- runner_config: &Arc<MatchRunnerConfig>,
+ runner_config: &Arc<GlobalConfig>,
bot: Option<&db::bots::Bot>,
bot_version: &db::bots::BotVersion,
) -> Box<dyn BotSpec> {
@@ -127,7 +121,7 @@ pub fn bot_version_to_botspec(
}
fn python_docker_bot_spec(
- runner_config: &Arc<MatchRunnerConfig>,
+ runner_config: &Arc<GlobalConfig>,
code_bundle_path: &str,
) -> Box<dyn BotSpec> {
let code_bundle_rel_path = PathBuf::from(BOTS_DIR).join(code_bundle_path);