CHANGE: Mini Profiler only enabled for developers in prd

This commit is contained in:
Sam 2014-07-17 08:34:30 +10:00
parent acee21cb6f
commit 9468ebeb2e
8 changed files with 12 additions and 12 deletions

View File

@ -305,7 +305,7 @@ class ApplicationController < ActionController::Base
end
def mini_profiler_enabled?
defined?(Rack::MiniProfiler) && current_user.try(:admin?)
defined?(Rack::MiniProfiler) && guardian.is_developer?
end
def authorize_mini_profiler

View File

@ -52,8 +52,8 @@ Discourse::Application.configure do
# this setting enables rack_cache so it caches various requests in redis
config.enable_rack_cache = true
# allows admins to use mini profiler
config.enable_mini_profiler = true
# allows developers to use mini profiler
config.load_mini_profiler = true
# allows Cross-origin resource sharing (CORS) for API access in JavaScript (default to false for security).
# See the initializer and https://github.com/cyu/rack-cors for configuration documentation.

View File

@ -67,8 +67,8 @@ smtp_enable_start_tls = true
# to disable, set to 'none'
smtp_openssl_verify_mode =
# enable MiniProfiler for administrators
enable_mini_profiler = true
# load MiniProfiler in production, to be used by developers
load_mini_profiler = true
# recommended, cdn used to access assets
cdn_url =

View File

@ -28,8 +28,8 @@ smtp_password =
# enable TLS encryption for smtp connections
smtp_enable_start_tls = true
# enable MiniProfiler for administrators, by default this is true. This shows response times in the top left for admin users only. Uncomment this line to turn this off.
# enable_mini_profiler = false
# enable MiniProfiler for developers, by default this is true. This shows response times in the top left for admin users only. Uncomment this line to turn this off.
# load_mini_profiler = false
# recommended, cdn used to access assets. This can be left empty at first.
cdn_url =

View File

@ -36,7 +36,7 @@ Discourse::Application.configure do
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP']
config.enable_mini_profiler = true
config.load_mini_profiler = true
require 'middleware/turbo_dev'
require 'middleware/missing_avatars'

View File

@ -50,8 +50,8 @@ Discourse::Application.configure do
# this will cause all handlebars templates to be pre-compiles, making your page faster
config.handlebars.precompile = true
# allows admins to use mini profiler
config.enable_mini_profiler = GlobalSetting.enable_mini_profiler
# allows developers to use mini profiler
config.load_mini_profiler = GlobalSetting.load_mini_profiler
# Discourse strongly recommend you use a CDN.
# For origin pull cdns all you need to do is register an account and configure

View File

@ -41,7 +41,7 @@ Discourse::Application.configure do
config.handlebars.precompile = true
# allows users to use mini profiler
config.enable_mini_profiler = false
config.load_mini_profiler = false
# for profiling with perftools
# config.middleware.use ::Rack::PerftoolsProfiler, default_printer: 'gif'

View File

@ -1,5 +1,5 @@
# If Mini Profiler is included via gem
if Rails.configuration.respond_to?(:enable_mini_profiler) && Rails.configuration.enable_mini_profiler
if Rails.configuration.respond_to?(:load_mini_profiler) && Rails.configuration.load_mini_profiler
require 'rack-mini-profiler'
require 'flamegraph'
require 'memory_profiler' if RUBY_VERSION >= "2.1.0"