Skip to content

Commit

Permalink
Move Rack::MiniProfiler authorization to initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
timurvafin committed Oct 14, 2015
1 parent 6fbe320 commit 5c17376
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ApplicationController < ActionController::Base
include Authentication
include Authorization
include MiniProfilerAuthorization

protect_from_forgery with: :exception
responders :flash
Expand Down
17 changes: 0 additions & 17 deletions app/controllers/concerns/mini_profiler_authorization.rb

This file was deleted.

7 changes: 7 additions & 0 deletions config/initializers/mini_profiler.rb
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
mini_profiler_ip_whitelist = ENV.fetch("MINI_PROFILER_IP_WHITELIST", "").split(",")

Rack::MiniProfiler.config.pre_authorize_cb = lambda { |env|
request = Rack::Request.new(env)
mini_profiler_ip_whitelist.include?(request.ip)
}

Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemoryStore

0 comments on commit 5c17376

Please sign in to comment.