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:
@@ -8,7 +8,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.28.2", features = ["full"] }
|
tokio = { version = "1.28.2", features = ["full"] }
|
||||||
axum = "0.6.18"
|
axum = "0.6.18"
|
||||||
sentry = "0.31.3"
|
sentry = { version = "0.31.3", features = ["debug-images"] }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = "0.4.18"
|
log = "0.4.18"
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub api_key: String,
|
pub api_key: String,
|
||||||
|
|
||||||
pub sentry_sdn: String,
|
pub sentry_dsn: String,
|
||||||
|
|
||||||
pub postgres_db_name: String,
|
pub postgres_db_name: String,
|
||||||
pub postgres_host: String,
|
pub postgres_host: String,
|
||||||
@@ -22,7 +22,7 @@ impl Config {
|
|||||||
Config {
|
Config {
|
||||||
api_key: get_env("API_KEY"),
|
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_db_name: get_env("POSTGRES_DB_NAME"),
|
||||||
postgres_host: get_env("POSTGRES_HOST"),
|
postgres_host: get_env("POSTGRES_HOST"),
|
||||||
|
|||||||
13
src/main.rs
13
src/main.rs
@@ -6,7 +6,8 @@ pub mod updater;
|
|||||||
pub mod models;
|
pub mod models;
|
||||||
|
|
||||||
use axum::{http::HeaderMap, routing::post, Router};
|
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 {
|
async fn update(headers: HeaderMap) -> &'static str {
|
||||||
let config_api_key = config::CONFIG.api_key.clone();
|
let config_api_key = config::CONFIG.api_key.clone();
|
||||||
@@ -32,9 +33,17 @@ async fn update(headers: HeaderMap) -> &'static str {
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let _guard = sentry::init(config::CONFIG.sentry_sdn.clone());
|
|
||||||
env_logger::init();
|
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 app = Router::new().route("/update", post(update));
|
||||||
|
|
||||||
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
|
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
|
||||||
|
|||||||
Reference in New Issue
Block a user