Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
23
crates/churn/src/server.rs
Normal file
23
crates/churn/src/server.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
pub mod config;
|
||||
|
||||
mod grpc_server;
|
||||
|
||||
use crate::{api, state::SharedState};
|
||||
|
||||
pub async fn execute(
|
||||
host: impl Into<SocketAddr>,
|
||||
grpc_host: impl Into<SocketAddr>,
|
||||
config: config::ServerConfig,
|
||||
) -> anyhow::Result<()> {
|
||||
let state = SharedState::new(config).await?;
|
||||
|
||||
notmad::Mad::builder()
|
||||
.add(api::Api::new(&state, host))
|
||||
.add(grpc_server::GrpcServer::new(grpc_host.into()))
|
||||
.run()
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user