add apprise_ok

This commit is contained in:
Astro 2023-01-01 20:57:48 +01:00
parent 887adf5f2c
commit 9a7c24acbd
1 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@ use std::net::SocketAddr;
use askama::Template; use askama::Template;
use axum::{ use axum::{
extract::State, extract::State,
routing::post, routing::{get, post},
http::StatusCode, http::StatusCode,
response::{IntoResponse, Response}, response::{IntoResponse, Response},
Json, Router, Json, Router,
@ -67,6 +67,12 @@ async fn apprise_notification(
.await .await
} }
async fn apprise_ok(
) -> Response {
([("content-type", "application/json")], "{}")
.into_response()
}
#[derive(Deserialize)] #[derive(Deserialize)]
struct Config { struct Config {
listen_port: u16, listen_port: u16,
@ -91,7 +97,7 @@ async fn main() {
// build our application with a route // build our application with a route
let app = Router::new() let app = Router::new()
.route("/alert", post(prometheus_alerts)) .route("/alert", post(prometheus_alerts))
.route("/notify", post(apprise_notification)) .route("/notify", get(apprise_ok).post(apprise_notification))
.with_state(jabber); .with_state(jabber);
let addr = SocketAddr::from(([127, 0, 0, 1], config.listen_port)); let addr = SocketAddr::from(([127, 0, 0, 1], config.listen_port));