chore: Minor Housekeeping tasks (#3169)

- Limit Rack attack to production environments
- Make the long-running data migration optional
This commit is contained in:
Sojan Jose
2021-10-08 15:45:45 +05:30
committed by GitHub
parent 1c4afb10df
commit 0e0632be22
3 changed files with 2 additions and 6 deletions

View File

@@ -85,4 +85,4 @@ ActiveSupport::Notifications.subscribe('throttle.rack_attack') do |_name, _start
Rails.logger.info "[Rack::Attack][Blocked] remote_ip: \"#{payload[:request].remote_ip}\", path: \"#{payload[:request].path}\""
end
Rack::Attack.enabled = ActiveModel::Type::Boolean.new.cast(ENV.fetch('ENABLE_RACK_ATTACK', true))
Rack::Attack.enabled = Rails.env.production? ? ActiveModel::Type::Boolean.new.cast(ENV.fetch('ENABLE_RACK_ATTACK', true)) : false