mirror of
https://github.com/flibusta-apps/meilie_updater.git
synced 2025-12-06 15:15:37 +01:00
Fix
This commit is contained in:
@@ -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"),
|
||||
|
||||
13
src/main.rs
13
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));
|
||||
|
||||
Reference in New Issue
Block a user