diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-06-12 21:03:41 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-06-12 21:03:41 +0200 |
commit | dde0bc820e47a372c9b1042249637c708a323188 (patch) | |
tree | 633469d62179969828537076f4f9c5ea1e5497bf /planetwars-server/src/lib.rs | |
parent | cf248ff41ac3510e608804937b0a05d4d4ffc758 (diff) | |
download | planetwars.dev-dde0bc820e47a372c9b1042249637c708a323188.tar.xz planetwars.dev-dde0bc820e47a372c9b1042249637c708a323188.zip |
accept docker push
Diffstat (limited to 'planetwars-server/src/lib.rs')
-rw-r--r-- | planetwars-server/src/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 28d7a76..e50003c 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -16,6 +16,7 @@ use bb8_diesel::{self, DieselConnectionManager}; use config::ConfigError; use diesel::{Connection, PgConnection}; use modules::ranking::run_ranker; +use modules::registry::registry_service; use serde::Deserialize; use axum::{ @@ -104,11 +105,22 @@ pub fn get_config() -> Result<Configuration, ConfigError> { .try_deserialize() } +async fn run_registry(_db_pool: DbPool) { + // TODO: put in config + let addr = SocketAddr::from(([127, 0, 0, 1], 9001)); + + axum::Server::bind(&addr) + .serve(registry_service().into_make_service()) + .await + .unwrap(); +} + 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())); + tokio::spawn(run_registry(db_pool.clone())); let api_service = Router::new() .nest("/api", api()) |