fix mp in prd

This commit is contained in:
Sam 2013-03-24 20:36:55 -07:00
parent f921d1c547
commit 622568fd57

View File

@ -19,8 +19,11 @@ if defined?(Rack::MiniProfiler)
# with a load balancer in front this becomes really bad as some results can
# be stored associated with ip1 as the user and retrieved using ip2 causing 404s
Rack::MiniProfiler.config.user_provider = lambda do |env|
user = CurrentUser.lookup_from_env(env)
user ? user.id.to_s : Rack::Request.new(env).ip
request = Rack::Request.new(env)
id = request.cookies["_t"] || request.ip || "unknown"
id = id.to_s
# some security, lets not have these tokens floating about
Digest::MD5.hexdigest(id)
end
Rack::MiniProfiler.config.position = 'left'