mirror of
https://github.com/flibusta-apps/meilie_updater.git
synced 2026-03-02 22:55:22 +01:00
Add health check endpoint
This commit is contained in:
@@ -13,6 +13,10 @@ use tower_http::trace::{self, TraceLayer};
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::{filter, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
async fn health() -> &'static str {
|
||||
"OK"
|
||||
}
|
||||
|
||||
async fn update(headers: HeaderMap) -> &'static str {
|
||||
let config_api_key = config::CONFIG.api_key.clone();
|
||||
|
||||
@@ -57,7 +61,10 @@ async fn main() {
|
||||
.with(sentry_layer)
|
||||
.init();
|
||||
|
||||
let app = Router::new().route("/update", post(update)).layer(
|
||||
let app = Router::new()
|
||||
.route("/health", axum::routing::get(health))
|
||||
.route("/update", post(update))
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
|
||||
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
|
||||
|
||||
Reference in New Issue
Block a user