-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* deps: Add `sentry` * chore: Initilize sentry client
- Loading branch information
Showing
4 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
ENV_NAME=development | ||
DISCORD_API_TOKEN= | ||
REDMINE_URL=http://localhost:8080 | ||
REDMINE_API_KEY= | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ mod redmine; | |
|
||
#[derive(serde::Serialize, serde::Deserialize, Debug)] | ||
pub struct IdeaReactionEnv { | ||
pub env_name: String, | ||
pub discord_api_token: String, | ||
pub redmine_api_key: String, | ||
pub redmine_url: String, | ||
|
@@ -38,6 +39,22 @@ async fn main() -> anyhow::Result<()> { | |
} | ||
|
||
let envs = envs(); | ||
|
||
let _guard = if &envs.env_name == "production" { | ||
let client = sentry::init(( | ||
"https://[email protected]//5", | ||
sentry::ClientOptions { | ||
release: sentry::release_name!(), | ||
traces_sample_rate: 1.0, | ||
..Default::default() | ||
}, | ||
)); | ||
sentry::configure_scope(|s| s.set_level(Some(sentry::Level::Warning))); | ||
Some(client) | ||
} else { | ||
None | ||
}; | ||
|
||
let intents = | ||
GatewayIntents::GUILD_MESSAGES | GatewayIntents::GUILDS | GatewayIntents::MESSAGE_CONTENT; | ||
let mut client = Client::builder(&envs.discord_api_token, intents) | ||
|