diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-07-06 00:15:29 +0300 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-07-18 20:43:35 +0300 |
commit | 3ee8eb113d019df8e5312af42fb2f369577c324c (patch) | |
tree | 21fece9ef32f71c67e715650c87c2b02ca02024d /config/initializers/secure_headers.rb | |
parent | 2e9bf6a750e92a729266ac6ed2f8e32385aa4ec4 (diff) |
Only report to Sentry when it's enabled.
Diffstat (limited to 'config/initializers/secure_headers.rb')
-rw-r--r-- | config/initializers/secure_headers.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/config/initializers/secure_headers.rb b/config/initializers/secure_headers.rb index e69117e0521..6cc7484d748 100644 --- a/config/initializers/secure_headers.rb +++ b/config/initializers/secure_headers.rb @@ -1,8 +1,12 @@ require 'gitlab/current_settings' include Gitlab::CurrentSettings -uri = URI.parse(current_application_settings.sentry_dsn) -CSP_REPORT_URI = "#{uri.scheme}://#{uri.host}/api#{uri.path}/csp-report/?sentry_key=#{uri.user}" +if Rails.env.production? && current_application_settings.sentry_enabled + uri = URI.parse(current_application_settings.sentry_dsn) + CSP_REPORT_URI = "#{uri.scheme}://#{uri.host}/api#{uri.path}/csp-report/?sentry_key=#{uri.user}" +else + CSP_REPORT_URI = '' +end SecureHeaders::Configuration.default do |config| config.cookies = { |