summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2017-09-23 09:13:29 -0600
committermo <mo.khan@gmail.com>2017-09-23 09:13:29 -0600
commitafc870216e5eb02c1c73ed018d21ec2d027db041 (patch)
tree6c96a7d40c31a131f10e2da702afc4e685d17381 /config
parent49ee70b30b2e114622f90bcf77ded003908006aa (diff)
upgrade specs
Diffstat (limited to 'config')
-rw-r--r--config/environments/test.rb6
-rw-r--r--config/initializers/rack_attack.rb4
2 files changed, 6 insertions, 4 deletions
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 762da2fe..1adb7779 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -13,9 +13,11 @@ Rails.application.configure do
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_files = true
+ config.public_file_server.enabled = true
- config.static_cache_control = "public, max-age=3600"
+ config.public_file_server.headers = {
+ 'Cache-Control' => "public, max-age=3600"
+ }
# Show full error reports and disable caching.
config.consider_all_requests_local = true
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index 7a26dd95..624c8996 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -1,12 +1,12 @@
# Always allow requests from localhost
# (blacklist & throttles are skipped)
-Rack::Attack.whitelist('allow from localhost') do |request|
+Rack::Attack.safelist('allow from localhost') do |request|
# Requests are allowed if the return value is truthy
'127.0.0.1' == request.ip
end
# Throttle requests to 5 requests per second per ip
-Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second) do |request|
+Rack::Attack.throttle('req/ip', limit: 5, period: 1.second) do |request|
# If the return value is truthy, the cache key for the return value
# is incremented and compared with the limit. In this case:
# "rack::attack:#{Time.now.to_i/1.second}:req/ip:#{req.ip}"