24 lines
480 B
Rust
24 lines
480 B
Rust
|
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(())
|
||
|
}
|