Add /up endpoint for uptime monitoring

This commit is contained in:
Aadi Desai 2023-10-25 00:29:27 +01:00
parent 125dca39b9
commit 1fc926a989
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
2 changed files with 18 additions and 11 deletions

View file

@ -115,16 +115,18 @@ async fn poise(
tracing::info!("Secrets loaded");
// Build Axum Router
let router = axum::Router::new().route(
"/verify",
axum::routing::post({
let pool = pool.clone();
let key = secret_store
.get("VERIFY_KEY")
.context("VERIFY_KEY not found")?;
move |body| routes::verify(pool, body, key)
}),
);
let router = axum::Router::new()
.route("/up", axum::routing::get(routes::up))
.route(
"/verify",
axum::routing::post({
let pool = pool.clone();
let key = secret_store
.get("VERIFY_KEY")
.context("VERIFY_KEY not found")?;
move |body| routes::verify(pool, body, key)
}),
);
// Build Poise Instance
let discord = poise::Framework::builder()

View file

@ -1,7 +1,12 @@
use crate::PendingMember;
use axum::{http::StatusCode, response::IntoResponse, Json};
#[derive(serde::Deserialize, serde::Serialize)]
#[tracing::instrument]
pub(crate) async fn up() -> impl IntoResponse {
(StatusCode::OK, "Nano is up!")
}
#[derive(serde::Deserialize)]
pub(crate) struct Verify {
id: String,
shortcode: String,