diff options
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index 0d266bf..b86d018 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,6 @@ pub use config::ConfigError; use lazy_static::lazy_static; +use sentry::ClientInitGuard; use serde::Deserialize; #[derive(Deserialize)] @@ -11,6 +12,7 @@ pub struct Configuration { pub database_url: String, pub jwt_secret: String, pub allowed_host: String, + pub sentry_dsn: Option<String>, } impl Configuration { @@ -19,6 +21,19 @@ impl Configuration { cfg.merge(config::Environment::default())?; cfg.try_into() } + + pub fn set_sentry_guard(&self) -> Option<ClientInitGuard> { + match &self.sentry_dsn { + Some(dsn) => Some(sentry::init(( + dsn.clone(), + sentry::ClientOptions { + release: sentry::release_name!(), + ..Default::default() + }, + ))), + None => None, + } + } } lazy_static! { |
