Skip to content

Commit

Permalink
merge main, and make sentry_dsn check more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
toufali committed Feb 23, 2024
2 parents 3c53b30 + 4092bb4 commit 1457200
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# frozen_string_literal: true

sentry_dsn = ENV.fetch('SENTRY_DSN', nil)
# RAILS_ENV is set to 'production' for both stage and prod servers.
# We use LOCAL_DOMAIN to differentiate for better Sentry logging.
local_domain = ENV.fetch('LOCAL_DOMAIN', '')
sentry_dsn = ENV.fetch('SENTRY_DSN', '')

sentry_dsn && Sentry.init do |config|
sentry_dsn.present? && Sentry.init do |config|
config.dsn = sentry_dsn
config.environment = if local_domain['mozilla.social']
'production'
elsif local_domain['stage']
'staging'
else
'development'
end

config.breadcrumbs_logger = [:active_support_logger, :http_logger]

# Set traces_sample_rate to 1.0 to capture 100%
Expand Down

0 comments on commit 1457200

Please sign in to comment.