about summary refs log tree commit diff
path: root/config/initializers/mini_profiler.rb
blob: 265783618d7b2f4b0c5973e6f17209e3771e643a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'rack-mini-profiler'

Rack::MiniProfilerRails.initialize!(Rails.application)

Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler)
Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater)

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

if Rails.env.production?
  Rack::MiniProfiler.config.storage_options = {
    host: ENV.fetch('REDIS_HOST') { 'localhost' },
    port: ENV.fetch('REDIS_PORT') { 6379 },
  }

  Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore
end