summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-18 17:50:51 -0600
committermo khan <mo@mokhan.ca>2025-06-18 17:50:51 -0600
commit1e9a769e5e4af4684967473f0844f66c3958432c (patch)
tree6b4f315cc17f1a7469888fd2bff9a4dba12d2088 /src
parentfabafd3c434532935fa74fe8a75c09b9bbfb51e9 (diff)
feat: register the health check service and the reflection service
Diffstat (limited to 'src')
-rw-r--r--src/main.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index f84dc08e..5af58aa0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -34,9 +34,19 @@ impl Authorization for PolicyServer {
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "[::1]:50051".parse()?;
-
+ let (health_reporter, health_service) = tonic_health::server::health_reporter();
+ health_reporter
+ .set_serving::<AuthorizationServer<PolicyServer>>()
+ .await;
+
+ let reflection_service = tonic_reflection::server::Builder::configure()
+ .register_encoded_file_descriptor_set(tonic_health::pb::FILE_DESCRIPTOR_SET)
+ .build_v1()
+ .unwrap();
Server::builder()
+ .add_service(health_service)
.add_service(AuthorizationServer::new(PolicyServer::default()))
+ .add_service(reflection_service)
.serve(addr)
.await?;