Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
30 lines
580 B
Rust
30 lines
580 B
Rust
use std::net::SocketAddr;
|
|
|
|
use crate::{
|
|
api::axum_serve,
|
|
app::{App, SharedApp},
|
|
grpc::tonic_serve,
|
|
};
|
|
|
|
pub async fn run_server(
|
|
host: impl Into<SocketAddr>,
|
|
grpc_host: impl Into<SocketAddr>,
|
|
) -> anyhow::Result<()> {
|
|
tracing_subscriber::fmt::init();
|
|
|
|
tracing::info!("Starting service");
|
|
|
|
let app = SharedApp::new(App::new().await?);
|
|
|
|
tokio::select! {
|
|
res = axum_serve(host.into(), app.clone()) => {
|
|
res?;
|
|
},
|
|
res = tonic_serve(grpc_host.into(), app.clone()) => {
|
|
res?;
|
|
},
|
|
};
|
|
|
|
Ok(())
|
|
}
|