diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 783ac89d5..c4d29ce96 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -64,7 +64,9 @@ match_data = request.env['rack.attack.match_data'] now = match_data[:epoch_time] - Honeybadger.notify("Throttling request", context: { ip: request.ip, path: request.path }.merge(match_data)) if match_data[:count] < 15 || (match_data[:count] % 10).zero? + if (Settings.SEND_THROTTLE_NOTIFICATIONS_TO_HONEYBADGER && match_data[:count] < 15) || (match_data[:count] % 10).zero? + Honeybadger.notify("Throttling request", context: { ip: request.ip, path: request.path }.merge(match_data)) + end headers = { 'RateLimit-Limit' => match_data[:limit].to_s, diff --git a/config/settings.yml b/config/settings.yml index 1bc6eab35..3283c3b19 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -23,6 +23,7 @@ GENERATE_SITEMAP: true DEVISE_SECRET_KEY: <%= Rails.application.secret_key_base %> DISABLE_SESSIONS: false THROTTLE_TRAFFIC: false +SEND_THROTTLE_NOTIFICATIONS_TO_HONEYBADGER: true OCLC: API_KEY: the-oclc-api-key BASE_URL: http://www.worldcat.org/webservices/catalog/content/citations