some fixes, first push to ovh, discord webhook
This commit is contained in:
33
src/main.rs
33
src/main.rs
@@ -5,6 +5,8 @@ use jsonwebtoken::{DecodingKey, EncodingKey};
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use reqwest::Client;
|
||||
|
||||
mod utils;
|
||||
mod routes;
|
||||
mod rooms;
|
||||
@@ -23,12 +25,43 @@ use std::env;
|
||||
use dotenvy::dotenv;
|
||||
|
||||
|
||||
pub async fn notify_discord(msg: &str) -> Result<(), reqwest::Error> {
|
||||
let payload = serde_json::json!({
|
||||
"content": msg
|
||||
});
|
||||
|
||||
reqwest::Client::new()
|
||||
.post("https://discord.com/api/webhooks/1440912618205347891/Ekg89krDoPm41kA27LA3gXgNWmMWvCCtziYIUsjqaY22Jnw4a6IWhZOht0in5JjnPX-W")
|
||||
.json(&payload)
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
#[tokio::main(flavor = "multi_thread", worker_threads = 8)]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
|
||||
dotenv().ok();
|
||||
|
||||
std::panic::set_hook(Box::new(|info| {
|
||||
let msg = format!("Rust panic: {}", info);
|
||||
|
||||
// Use blocking client so the process can't exit before sending
|
||||
let payload = serde_json::json!({
|
||||
"content": msg
|
||||
});
|
||||
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let _ = client
|
||||
.post("https://discord.com/api/webhooks/1440912618205347891/Ekg89krDoPm41kA27LA3gXgNWmMWvCCtziYIUsjqaY22Jnw4a6IWhZOht0in5JjnPX-W")
|
||||
.json(&payload)
|
||||
.send();
|
||||
}));
|
||||
|
||||
panic!("crash-test");
|
||||
|
||||
let hotel_pools = HotelPool::new();
|
||||
let logs_manager = SqliteConnectionManager::file("db/auth.sqlite");
|
||||
let logs_pool = Pool::builder()
|
||||
|
||||
Reference in New Issue
Block a user