feat(startup): make both servers be able to run seperately with specification by features

This commit is contained in:
DJMrTV 2025-02-08 13:30:43 +01:00
commit 56d8a6ca48
2 changed files with 12 additions and 1 deletions

View file

@ -27,4 +27,9 @@ hex = "0.4.3"
macros = { path = "macros" }
[build-dependencies]
tonic-build = "0.12.3"
tonic-build = "0.12.3"
[features]
default = ["secure", "auth"]
secure = []
auth = []

View file

@ -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");
}