diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-14 20:53:08 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-14 20:53:08 +0200 |
commit | 00459f9e3d818f0fb84160862f02898d64f98110 (patch) | |
tree | d7ace4d72e8031432086026e08d37c071bd81420 /planetwars-server/src/lib.rs | |
parent | 668409e76d8cc7797fe627b2e2c3d0223b3db684 (diff) | |
download | planetwars.dev-00459f9e3d818f0fb84160862f02898d64f98110.tar.xz planetwars.dev-00459f9e3d818f0fb84160862f02898d64f98110.zip |
create a configuration to hold docker registry url
Diffstat (limited to 'planetwars-server/src/lib.rs')
-rw-r--r-- | planetwars-server/src/lib.rs | 11 |
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 |