From 900f8f2f341824d1bf76c01c60246a00840c19d4 Mon Sep 17 00:00:00 2001 From: Timofey Luin Date: Mon, 23 Sep 2024 14:38:36 +0200 Subject: [PATCH] add healthcheck endpoint --- prover/src/rpc.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/prover/src/rpc.rs b/prover/src/rpc.rs index edc78bf..024a90a 100644 --- a/prover/src/rpc.rs +++ b/prover/src/rpc.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-only use ark_std::{end_timer, start_timer}; +use axum::routing::get; use axum::{http::StatusCode, response::IntoResponse, routing::post, Router}; use ethers::prelude::*; use jsonrpc_v2::{Data, RequestObject as JsonRpcRequestObject}; @@ -180,6 +181,12 @@ where )?) } +// health check endopoint +pub(crate) async fn health_check_handler( +) -> &'static str { + "UP" +} + pub async fn run_rpc( port: usize, config_dir: impl AsRef, @@ -202,6 +209,7 @@ where let rpc_server = Arc::new(jsonrpc_server::(state)); let router = Router::new() .route("/rpc", post(handler)) + .route("/health", get(health_check_handler)) .with_state(rpc_server); log::info!("Ready for RPC connections");