pub mod authorization; #[tokio::main] async fn main() -> Result<(), Box> { use envoy_types::ext_authz::v3::pb::AuthorizationServer; use std::sync::Arc; use tonic::transport::Server; let addr = "[::1]:50051".parse()?; let (_health_reporter, health_service) = tonic_health::server::health_reporter(); let authorizer = Arc::new(authorization::CedarAuthorizer::new()); let check_service = authorization::CheckService::new(authorizer); let server = Server::builder() .add_service(AuthorizationServer::new(check_service)) .add_service(health_service) .add_service( tonic_reflection::server::Builder::configure() .register_encoded_file_descriptor_set(tonic_health::pb::FILE_DESCRIPTOR_SET) .build_v1() .unwrap(), ); println!("Listening on... {addr}"); server.serve(addr).await?; Ok(()) }