diff --git a/Cargo.toml b/Cargo.toml index 1732ab6..11ebddd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] tokio = { version = "1.28.2", features = ["full"] } axum = "0.6.18" -sentry = "0.31.3" +sentry = { version = "0.31.3", features = ["debug-images"] } lazy_static = "1.4.0" log = "0.4.18" env_logger = "0.10.0" diff --git a/src/config.rs b/src/config.rs index d6da83e..22c1ccc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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"), diff --git a/src/main.rs b/src/main.rs index ae94978..366b16b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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));