impl webhook route

This commit is contained in:
2026-05-18 22:40:28 +02:00
parent 2cf50b0168
commit e33187dc80
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ use axum::routing::get;
use crate::env; use crate::env;
pub async fn start_api(config: env::EnvConfig) -> anyhow::Result<()> { pub async fn start_api(config: env::EnvConfig) -> anyhow::Result<()> {
let app = Router::new().route("/", get(root)); let app = Router::new().route("/webhook", get(webhook));
let listerner = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", config.http_port)).await?; let listerner = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", config.http_port)).await?;
axum::serve(listerner, app) axum::serve(listerner, app)
@@ -12,6 +12,6 @@ pub async fn start_api(config: env::EnvConfig) -> anyhow::Result<()> {
.map_err(|e| anyhow::anyhow!(e)) .map_err(|e| anyhow::anyhow!(e))
} }
async fn root() -> &'static str { async fn webhook() -> &'static str {
"Hello, World!" "Hello, World!"
} }
+1 -1
View File
@@ -1,5 +1,6 @@
use dotenvy::dotenv; use dotenvy::dotenv;
pub struct EnvConfig { pub struct EnvConfig {
pub http_port: u16, pub http_port: u16,
pub bot_name: String, pub bot_name: String,
@@ -9,7 +10,6 @@ pub fn load_config() -> anyhow::Result<EnvConfig> {
dotenv().ok(); dotenv().ok();
let http_port = std::env::var("HTTP_PORT")?.parse()?; let http_port = std::env::var("HTTP_PORT")?.parse()?;
let bot_name = std::env::var("BOT_NAME")?; let bot_name = std::env::var("BOT_NAME")?;
Ok(EnvConfig { Ok(EnvConfig {