]> git.openstreetmap.org Git - rails.git/blob - config/initializers/rate_limits.rb
Merge remote-tracking branch 'upstream/pull/4319'
[rails.git] / config / initializers / rate_limits.rb
1 require "rate_limiter"
2
3 SIGNUP_IP_LIMITER = if Settings.memcache_servers && Settings.signup_ip_per_day && Settings.signup_ip_max_burst
4                       RateLimiter.new(
5                         Dalli::Client.new(Settings.memcache_servers, :namespace => "rails:signup:ip"),
6                         86400, Settings.signup_ip_per_day, Settings.signup_ip_max_burst
7                       )
8                     end
9
10 SIGNUP_EMAIL_LIMITER = if Settings.memcache_servers && Settings.signup_email_per_day && Settings.signup_email_max_burst
11                          RateLimiter.new(
12                            Dalli::Client.new(Settings.memcache_servers, :namespace => "rails:signup:email"),
13                            86400, Settings.signup_email_per_day, Settings.signup_email_max_burst
14                          )
15                        end