From 56d8a6ca48177cff77b34a3fb9d937b4c098f070 Mon Sep 17 00:00:00 2001 From: DJMrTV Date: Sat, 8 Feb 2025 13:30:43 +0100 Subject: [PATCH] feat(startup): make both servers be able to run seperately with specification by features --- Cargo.toml | 7 ++++++- src/main.rs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 60d636d..321ded6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,4 +27,9 @@ hex = "0.4.3" macros = { path = "macros" } [build-dependencies] -tonic-build = "0.12.3" \ No newline at end of file +tonic-build = "0.12.3" + +[features] +default = ["secure", "auth"] +secure = [] +auth = [] \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 0454464..b2d7765 100644 --- a/src/main.rs +++ b/src/main.rs @@ -240,10 +240,16 @@ async fn start_secure_server() -> SecureServer{ } async fn start_servers(){ + + + #[cfg(feature = "auth")] let auth_server = start_auth_server().await; + #[cfg(feature = "secure")] let secure_server = start_secure_server().await; + #[cfg(feature = "auth")] auth_server.join_handle.await.expect("auth server crashed"); + #[cfg(feature = "secure")] secure_server.join_handle.await.expect("auth server crashed"); }