mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2026-03-02 22:55:23 +01:00
Add /health endpoint
This commit is contained in:
@@ -20,6 +20,10 @@ use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
use crate::updater::cron_jobs;
|
||||
|
||||
async fn health() -> &'static str {
|
||||
"OK"
|
||||
}
|
||||
|
||||
async fn update(headers: HeaderMap) -> &'static str {
|
||||
let config_api_key = config::CONFIG.api_key.clone();
|
||||
|
||||
@@ -43,7 +47,10 @@ async fn update(headers: HeaderMap) -> &'static str {
|
||||
}
|
||||
|
||||
async fn start_app() {
|
||||
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