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

16
Cargo.lock generated
View File

@@ -2858,7 +2858,7 @@ dependencies = [
[[package]]
name = "revolt-bonfire"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"async-std",
"async-tungstenite",
@@ -2875,7 +2875,7 @@ dependencies = [
[[package]]
name = "revolt-database"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"async-recursion",
"async-std",
@@ -2907,7 +2907,7 @@ dependencies = [
[[package]]
name = "revolt-delta"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"async-channel",
"async-std",
@@ -2948,7 +2948,7 @@ dependencies = [
[[package]]
name = "revolt-models"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"indexmap",
"iso8601-timestamp 0.2.11",
@@ -2961,7 +2961,7 @@ dependencies = [
[[package]]
name = "revolt-permissions"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"async-std",
"async-trait",
@@ -2975,7 +2975,7 @@ dependencies = [
[[package]]
name = "revolt-presence"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"async-std",
"log",
@@ -2986,7 +2986,7 @@ dependencies = [
[[package]]
name = "revolt-quark"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"async-lock",
"async-recursion",
@@ -3039,7 +3039,7 @@ dependencies = [
[[package]]
name = "revolt-result"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"revolt_okapi",
"revolt_rocket_okapi",

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-bonfire"
version = "0.6.5"
version = "0.6.6"
license = "AGPL-3.0-or-later"
edition = "2021"
@@ -25,7 +25,11 @@ serde = "1.0.136"
# async
futures = "0.3.21"
async-tungstenite = { version = "0.17.0", features = ["async-std-runtime"] }
async-std = { version = "1.8.0", features = ["tokio1", "tokio02", "attributes"] }
async-std = { version = "1.8.0", features = [
"tokio1",
"tokio02",
"attributes",
] }
# core
revolt-presence = { path = "../core/presence", features = [ "redis-is-patched" ] }
revolt-presence = { path = "../core/presence", features = ["redis-is-patched"] }

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-database"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -22,10 +22,10 @@ default = ["mongodb", "async-std-runtime"]
[dependencies]
# Core
revolt-result = { version = "0.6.5", path = "../result" }
revolt-models = { version = "0.6.5", path = "../models" }
revolt-presence = { version = "0.6.5", path = "../presence" }
revolt-permissions = { version = "0.6.5", path = "../permissions", features = [
revolt-result = { version = "0.6.6", path = "../result" }
revolt-models = { version = "0.6.6", path = "../models" }
revolt-presence = { version = "0.6.6", path = "../presence" }
revolt-permissions = { version = "0.6.6", path = "../permissions", features = [
"serde",
"bson",
] }

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-models"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -18,7 +18,7 @@ default = ["serde", "partials"]
[dependencies]
# Core
revolt-permissions = { version = "0.6.5", path = "../permissions" }
revolt-permissions = { version = "0.6.6", path = "../permissions" }
# Serialisation
indexmap = "1.9.3"

View File

@@ -1,18 +1,18 @@
[package]
name = "revolt-permissions"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = [ "Paul Makles <me@insrt.uk>" ]
authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Permission Logic"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
bson = ["dep:bson"]
serde = [ "dep:serde" ]
schemas = [ "dep:schemars" ]
try-from-primitive = [ "dep:num_enum" ]
serde = ["dep:serde"]
schemas = ["dep:schemars"]
try-from-primitive = ["dep:num_enum"]
[dev-dependencies]
@@ -30,7 +30,7 @@ async-trait = "0.1.51"
# Serialisation
serde = { version = "1", features = ["derive"], optional = true }
bson = { version = "2.1.0", optional = true}
bson = { version = "2.1.0", optional = true }
# Spec Generation
schemars = { version = "0.8.8", optional = true }
schemars = { version = "0.8.8", optional = true }

View File

@@ -1,9 +1,9 @@
[package]
name = "revolt-presence"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = [ "Paul Makles <me@insrt.uk>" ]
authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: User Presence"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,20 +1,20 @@
[package]
name = "revolt-result"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = [ "Paul Makles <me@insrt.uk>" ]
authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Result and Error types"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
serde = [ "dep:serde" ]
schemas = [ "dep:schemars" ]
rocket = [ "dep:rocket", "dep:serde_json" ]
okapi = [ "dep:revolt_rocket_okapi", "dep:revolt_okapi" ]
serde = ["dep:serde"]
schemas = ["dep:schemars"]
rocket = ["dep:rocket", "dep:serde_json"]
okapi = ["dep:revolt_rocket_okapi", "dep:revolt_okapi"]
default = [ "serde" ]
default = ["serde"]
[dependencies]
# Serialisation

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-delta"
version = "0.6.5"
version = "0.6.6"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <paulmakles@gmail.com>"]
edition = "2018"
@@ -38,29 +38,38 @@ futures = "0.3.8"
chrono = "0.4.15"
async-channel = "1.6.1"
reqwest = { version = "0.11.4", features = ["json"] }
async-std = { version = "1.8.0", features = ["tokio1", "tokio02", "attributes"] }
async-std = { version = "1.8.0", features = [
"tokio1",
"tokio02",
"attributes",
] }
# internal util
lettre = "0.10.0-alpha.4"
# web
rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] }
rocket = { version = "0.5.0-rc.2", default-features = false, features = [
"json",
] }
rocket_empty = { version = "0.1.1", features = ["schema"] }
rocket_authifier = { version = "1.0.7" }
rocket_prometheus = "0.10.0-rc.3"
# spec generation
schemars = "0.8.8"
revolt_rocket_okapi = { version = "0.9.1", features = [ "swagger" ] }
revolt_rocket_okapi = { version = "0.9.1", features = ["swagger"] }
# quark
revolt-quark = { path = "../quark" }
# core
revolt-database = { path = "../core/database", features = [ "rocket-impl", "redis-is-patched" ] }
revolt-models = { path = "../core/models", features = [ "schemas", "validator" ] }
revolt-result = { path = "../core/result", features = [ "rocket", "okapi" ] }
revolt-permissions = { path = "../core/permissions", features = [ "schemas" ] }
revolt-database = { path = "../core/database", features = [
"rocket-impl",
"redis-is-patched",
] }
revolt-models = { path = "../core/models", features = ["schemas", "validator"] }
revolt-result = { path = "../core/result", features = ["rocket", "okapi"] }
revolt-permissions = { path = "../core/permissions", features = ["schemas"] }
[build-dependencies]
vergen = "7.5.0"

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]