This commit is contained in:
2023-08-10 21:22:28 +02:00
parent 8d0b059762
commit 23fd5e7920
3 changed files with 14 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
pub struct Config {
pub api_key: String,
pub sentry_sdn: String,
pub sentry_dsn: String,
pub postgres_db_name: String,
pub postgres_host: String,
@@ -22,7 +22,7 @@ impl Config {
Config {
api_key: get_env("API_KEY"),
sentry_sdn: get_env("SENTRY_SDN"),
sentry_dsn: get_env("SENTRY_DSN"),
postgres_db_name: get_env("POSTGRES_DB_NAME"),
postgres_host: get_env("POSTGRES_HOST"),

View File

@@ -6,7 +6,8 @@ pub mod updater;
pub mod models;
use axum::{http::HeaderMap, routing::post, Router};
use std::net::SocketAddr;
use sentry::{ClientOptions, types::Dsn, integrations::debug_images::DebugImagesIntegration};
use std::{net::SocketAddr, str::FromStr};
async fn update(headers: HeaderMap) -> &'static str {
let config_api_key = config::CONFIG.api_key.clone();
@@ -32,9 +33,17 @@ async fn update(headers: HeaderMap) -> &'static str {
#[tokio::main]
async fn main() {
let _guard = sentry::init(config::CONFIG.sentry_sdn.clone());
env_logger::init();
let options = ClientOptions {
dsn: Some(Dsn::from_str(&config::CONFIG.sentry_dsn).unwrap()),
default_integrations: false,
..Default::default()
}
.add_integration(DebugImagesIntegration::new());
let _guard = sentry::init(options);
let app = Router::new().route("/update", post(update));
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));