aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'planetwars-server/src/lib.rs')
-rw-r--r--planetwars-server/src/lib.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs
index fdaf800..eb69c82 100644
--- a/planetwars-server/src/lib.rs
+++ b/planetwars-server/src/lib.rs
@@ -10,13 +10,14 @@ pub mod util;
use std::net::SocketAddr;
use std::ops::Deref;
+use std::sync::Arc;
use bb8::{Pool, PooledConnection};
use bb8_diesel::{self, DieselConnectionManager};
use config::ConfigError;
use diesel::{Connection, PgConnection};
-use modules::ranking::run_ranker;
use modules::registry::registry_service;
+use modules::{matches::MatchRunnerConfig, ranking::run_ranker};
use serde::Deserialize;
use axum::{
@@ -120,12 +121,18 @@ pub async fn run_app() {
let configuration = get_config().unwrap();
let db_pool = prepare_db(&configuration.database_url).await;
- tokio::spawn(run_ranker(db_pool.clone()));
+ let runner_config = Arc::new(MatchRunnerConfig {
+ python_runner_image: "python:3.10-slim-buster".to_string(),
+ container_registry_url: "localhost:9001".to_string(),
+ });
+
+ tokio::spawn(run_ranker(runner_config.clone(), db_pool.clone()));
tokio::spawn(run_registry(db_pool.clone()));
let api_service = Router::new()
.nest("/api", api())
.layer(Extension(db_pool))
+ .layer(Extension(runner_config))
.into_make_service();
// TODO: put in config