1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Make health reporter for gRPC
//! https://github.com/grpc/grpc/blob/master/doc/health-checking.md
//!
//! [supported in Kubernetes by default](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-grpc-liveness-probe)
//! ## Example
//! ```
//! extern crate tonic_health;
//! extern crate tonic;
//! use crate::vkteams_bot::bot::net::shutdown_signal;
//! use crate::vkteams_bot::error::Result;
//!
//! const DEFAULT_TCP_PORT: &str = "VKTEAMS_BOT_HTTP_PORT";
//! pub async fn run_probe_app() -> Result<()> {
//! // Create gRPC health reporter and service
//! let (_, health_service) = tonic_health::server::health_reporter();
//! // Get the port from the environment variable or use the default port 50555
//! let tcp_port = std::env::var(DEFAULT_TCP_PORT).unwrap_or_else(|_| "50555".to_string());
//! // Start gRPC server
//! tonic::transport::Server::builder()
//! .add_service(health_service)
//! .serve_with_shutdown(
//! format!("[::1]:{tcp_port}").parse().unwrap(),
//! shutdown_signal(),
//! )
//! .await?;
//! Ok(())
//! }
//! ```
use Router;
/// Inherit Router with gRPC probe
/// Implement GRPCRouter for Router