use std::sync::Arc;
use axum::Router;
use rustls::ServerConfig;
use tracing::info;
use super::config::GrpcSurface;
pub async fn serve(
surface: &GrpcSurface,
h2_config: Arc<tokio::sync::RwLock<Arc<ServerConfig>>>,
acme_challenge: Option<Arc<ServerConfig>>,
require_client_auth: bool,
) -> std::io::Result<()> {
let (mut reporter, health_service) = tonic_health::server::health_reporter();
reporter
.set_serving::<tonic_health::pb::health_server::HealthServer<tonic_health::server::HealthService>>()
.await;
let router = Router::new().fallback_service(health_service);
info!(listen = %surface.listen, "gRPC surface enabled (health service)");
crate::http_transport::serve_h2_tls(
surface.listen,
h2_config,
acme_challenge,
router,
require_client_auth,
)
.await
}