Sha256: 59c0eb8e0f2950f371f80b6e9c93c1b354859d9466864010ea41a1e49cdaaaec

Contents?: true

Size: 512 Bytes

Versions: 38

Compression:

Stored size: 512 Bytes

Contents

# frozen_string_literal: true

if Rails.env.production? || Rails.env.test?
  require "rack/attack"

  # Throttle check census attempts by IP to 6 reqs/minute
  # Return the IP as a discriminator on POST /check_census requests
  Rack::Attack.throttle(
    "limit check census data attempts per request by IP",
    limit: Decidim::Votings.check_census_max_requests,
    period: Decidim::Votings.throttling_period
  ) do |request|
    request.ip if request.path.include?("/check_census") && request.post?
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 config/initializers/rack_attack.rb
decidim-elections-0.27.9 config/initializers/rack_attack.rb
decidim-elections-0.28.3 config/initializers/rack_attack.rb
decidim-elections-0.27.8 config/initializers/rack_attack.rb
decidim-elections-0.28.2 config/initializers/rack_attack.rb
decidim-elections-0.27.7 config/initializers/rack_attack.rb
decidim-elections-0.28.1 config/initializers/rack_attack.rb
decidim-elections-0.27.6 config/initializers/rack_attack.rb
decidim-elections-0.26.10 config/initializers/rack_attack.rb
decidim-elections-0.26.9 config/initializers/rack_attack.rb
decidim-elections-0.28.0 config/initializers/rack_attack.rb
decidim-elections-0.27.5 config/initializers/rack_attack.rb
decidim-elections-0.28.0.rc5 config/initializers/rack_attack.rb
decidim-elections-0.28.0.rc4 config/initializers/rack_attack.rb
decidim-elections-0.26.8 config/initializers/rack_attack.rb
decidim-elections-0.27.4 config/initializers/rack_attack.rb
decidim-elections-0.27.3 config/initializers/rack_attack.rb
decidim-elections-0.26.7 config/initializers/rack_attack.rb
decidim-elections-0.26.5 config/initializers/rack_attack.rb
decidim-elections-0.27.2 config/initializers/rack_attack.rb