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 end
def mini_profiler_enabled? def mini_profiler_enabled?
defined?(Rack::MiniProfiler) && current_user.try(:admin?) defined?(Rack::MiniProfiler) && guardian.is_developer?
end end
def authorize_mini_profiler 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 # this setting enables rack_cache so it caches various requests in redis
config.enable_rack_cache = true config.enable_rack_cache = true
# allows admins to use mini profiler # allows developers to use mini profiler
config.enable_mini_profiler = true config.load_mini_profiler = true
# allows Cross-origin resource sharing (CORS) for API access in JavaScript (default to false for security). # 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. # 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' # to disable, set to 'none'
smtp_openssl_verify_mode = smtp_openssl_verify_mode =
# enable MiniProfiler for administrators # load MiniProfiler in production, to be used by developers
enable_mini_profiler = true load_mini_profiler = true
# recommended, cdn used to access assets # recommended, cdn used to access assets
cdn_url = cdn_url =

View File

@ -28,8 +28,8 @@ smtp_password =
# enable TLS encryption for smtp connections # enable TLS encryption for smtp connections
smtp_enable_start_tls = true 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 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.
# enable_mini_profiler = false # load_mini_profiler = false
# recommended, cdn used to access assets. This can be left empty at first. # recommended, cdn used to access assets. This can be left empty at first.
cdn_url = cdn_url =

View File

@ -36,7 +36,7 @@ Discourse::Application.configure do
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP'] 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/turbo_dev'
require 'middleware/missing_avatars' 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 # this will cause all handlebars templates to be pre-compiles, making your page faster
config.handlebars.precompile = true config.handlebars.precompile = true
# allows admins to use mini profiler # allows developers to use mini profiler
config.enable_mini_profiler = GlobalSetting.enable_mini_profiler config.load_mini_profiler = GlobalSetting.load_mini_profiler
# Discourse strongly recommend you use a CDN. # Discourse strongly recommend you use a CDN.
# For origin pull cdns all you need to do is register an account and configure # 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 config.handlebars.precompile = true
# allows users to use mini profiler # allows users to use mini profiler
config.enable_mini_profiler = false config.load_mini_profiler = false
# for profiling with perftools # for profiling with perftools
# config.middleware.use ::Rack::PerftoolsProfiler, default_printer: 'gif' # config.middleware.use ::Rack::PerftoolsProfiler, default_printer: 'gif'

View File

@ -1,5 +1,5 @@
# If Mini Profiler is included via gem # 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 'rack-mini-profiler'
require 'flamegraph' require 'flamegraph'
require 'memory_profiler' if RUBY_VERSION >= "2.1.0" require 'memory_profiler' if RUBY_VERSION >= "2.1.0"