diff options
author | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-04-11 00:50:09 +0000 |
---|---|---|
committer | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-04-11 00:50:09 +0000 |
commit | 33c2bbdda7f94789dc0455711093ee788c64a531 (patch) | |
tree | caced55ea5ede3baa6e13cf15d8a869121dd3d4f /config/initializers | |
parent | 67e77f230e93b2e2ac05632a7cccdb5f26537f3b (diff) | |
parent | d9b62e34da0c0238176f27557ac7b953da94df7e (diff) |
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/rack_attack_logging.rb | 4 | ||||
-rw-r--r-- | config/initializers/sidekiq.rb | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/config/initializers/rack_attack_logging.rb b/config/initializers/rack_attack_logging.rb new file mode 100644 index 000000000..2ddbfb99c --- /dev/null +++ b/config/initializers/rack_attack_logging.rb @@ -0,0 +1,4 @@ +ActiveSupport::Notifications.subscribe('rack.attack') do |_name, _start, _finish, _request_id, req| + next unless [:throttle, :blacklist].include? req.env['rack.attack.match_type'] + Rails.logger.info("Rate limit hit (#{req.env['rack.attack.match_type']}): #{req.ip} #{req.request_method} #{req.fullpath}") +end diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index f875fbd95..05c804100 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -namespace = ENV.fetch('REDIS_NAMESPACE') { nil } +namespace = ENV.fetch('REDIS_NAMESPACE') { nil } redis_params = { url: ENV['REDIS_URL'] } if namespace - redis_params [:namespace] = namespace + redis_params[:namespace] = namespace end Sidekiq.configure_server do |config| @@ -18,3 +18,5 @@ end Sidekiq.configure_client do |config| config.redis = redis_params end + +Sidekiq::Logging.logger.level = ::Logger::const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s) |