diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 2b7673329c8b7a..30b023ff0cfa02 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -1,6 +1,18 @@ # frozen_string_literal: true +# 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', nil) + Sentry.init do |config| + config.environment = if local_domain['mozilla.social'] + 'production' + elsif local_domain['stage'] + 'staging' + else + 'development' + end + config.dsn = 'https://def412573e2b44d39e73a130b09bb25a@o1069899.ingest.sentry.io/4506591637471232' config.breadcrumbs_logger = [:active_support_logger, :http_logger]