debian-mirror-gitlab/config/initializers/sentry.rb

28 lines
923 B
Ruby
Raw Normal View History

2016-01-29 22:53:50 +05:30
# Be sure to restart your server when you modify this file.
require 'gitlab/current_settings'
2018-03-17 18:26:18 +05:30
def configure_sentry
2016-01-29 22:53:50 +05:30
# allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done
begin
2018-03-17 18:26:18 +05:30
sentry_enabled = Gitlab::CurrentSettings.current_application_settings.sentry_enabled
2016-01-29 22:53:50 +05:30
rescue
sentry_enabled = false
end
if sentry_enabled
Raven.configure do |config|
2018-03-17 18:26:18 +05:30
config.dsn = Gitlab::CurrentSettings.current_application_settings.sentry_dsn
2016-04-02 18:10:28 +05:30
config.release = Gitlab::REVISION
2017-08-17 22:00:37 +05:30
2016-06-02 11:05:42 +05:30
# Sanitize fields based on those sanitized from Rails.
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
2016-11-03 12:29:30 +05:30
# Sanitize authentication headers
config.sanitize_http_headers = %w[Authorization Private-Token]
2016-09-29 09:46:39 +05:30
config.tags = { program: Gitlab::Sentry.program_context }
2016-01-29 22:53:50 +05:30
end
end
end
2018-03-17 18:26:18 +05:30
configure_sentry if Rails.env.production?