From 597fdcbfd348e209a3e19168fada8a533a29c4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20W=C3=B3jcik?= Date: Fri, 11 Aug 2023 11:40:20 +0200 Subject: [PATCH] add healthcheck endpoint --- src/server.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server.rs b/src/server.rs index b06f506..393b496 100644 --- a/src/server.rs +++ b/src/server.rs @@ -50,6 +50,10 @@ async fn app_info() -> ApiResult> { Ok(Json(AppInfo { version })) } +async fn healthcheck() -> &'static str { + "I'm alive!" +} + pub async fn run_server(config: Config) -> anyhow::Result<()> { info!("Starting Defguard proxy server"); @@ -78,6 +82,7 @@ pub async fn run_server(config: Config) -> anyhow::Result<()> { "/api/v1", Router::new() .nest("/enrollment", enrollment::router()) + .route("/health", get(healthcheck)) .route("/info", get(app_info)), ) .nest_service("/svg", serve_images)