feat: add SENTRY_DSN env variable

This commit is contained in:
Paul Makles
2023-08-10 09:40:41 +01:00
parent a0580c5f5a
commit f5f70287e7
10 changed files with 80 additions and 61 deletions

View File

@@ -1,13 +1,13 @@
[package]
name = "revolt-quark"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
license = "AGPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
mongo = [ "mongodb" ]
mongo = ["mongodb"]
rocket_impl = [
"rocket",
"rocket_empty",
@@ -18,11 +18,11 @@ rocket_impl = [
"authifier/database-mongodb",
"authifier/rocket_impl",
"authifier/okapi_impl"
"authifier/okapi_impl",
]
test = [ "async-std", "mongo", "mongodb/async-std-runtime", "rocket_impl" ]
default = [ "test" ]
test = ["async-std", "mongo", "mongodb/async-std-runtime", "rocket_impl"]
default = ["test"]
[dependencies]
# Serialisation
@@ -39,7 +39,7 @@ bson = { version = "2.1.0", features = ["chrono-0_4"] }
# Spec Generation
schemars = "0.8.8"
revolt_okapi = "0.9.1"
revolt_rocket_okapi = { version = "0.9.1", features = [ "swagger" ] }
revolt_rocket_okapi = { version = "0.9.1", features = ["swagger"] }
# Databases
redis-kiss = { version = "0.1.4" }
@@ -81,18 +81,20 @@ web-push = "0.7.2"
# Implementations
rocket_http = { optional = true, version = "0.5.0-rc.2" }
rocket = { optional = true, version = "0.5.0-rc.2", default-features = false, features = ["json"] }
rocket_empty = { version = "0.1.1", optional = true, features = [ "schema" ] }
rocket = { optional = true, version = "0.5.0-rc.2", default-features = false, features = [
"json",
] }
rocket_empty = { version = "0.1.1", optional = true, features = ["schema"] }
rocket_cors = { optional = true, git = "https://github.com/lawliet89/rocket_cors", rev = "c17e8145baa4790319fdb6a473e465b960f55e7c" }
# Authifier
authifier = { version = "1.0.7", features = [ "async-std-runtime" ] }
authifier = { version = "1.0.7", features = ["async-std-runtime"] }
# Sentry
sentry = "0.25.0"
# Core
revolt-result = { path = "../core/result", features = [ "serde", "schemas" ] }
revolt-presence = { path = "../core/presence", features = [ "redis-is-patched" ] }
revolt-result = { path = "../core/result", features = ["serde", "schemas"] }
revolt-presence = { path = "../core/presence", features = ["redis-is-patched"] }
revolt-database = { path = "../core/database" }
revolt-models = { path = "../core/models" }

View File

@@ -1,5 +1,5 @@
/// Configure logging and common Rust variables
pub fn setup_logging(release: &'static str) -> sentry::ClientInitGuard {
pub fn setup_logging(release: &'static str) -> Option<sentry::ClientInitGuard> {
dotenv::dotenv().ok();
if std::env::var("RUST_LOG").is_err() {
@@ -13,13 +13,17 @@ pub fn setup_logging(release: &'static str) -> sentry::ClientInitGuard {
pretty_env_logger::init();
info!("Starting {release}");
sentry::init((
"https://d1d2a6f15c6245a987c532bbbcb30a04@glitchtip.insert.moe/2",
sentry::ClientOptions {
release: Some(release.into()),
..Default::default()
},
))
if let Ok(dsn) = std::env::var("SENTRY_DSN") {
Some(sentry::init((
dsn,
sentry::ClientOptions {
release: Some(release.into()),
..Default::default()
},
)))
} else {
None
}
}
#[macro_export]