mini profiler fix for multisite

This commit is contained in:
Sam
2013-03-24 23:19:59 -07:00
parent 8ce9eefdce
commit 36d60befbd
2 changed files with 18 additions and 5 deletions

View File

@ -3,11 +3,20 @@
#
class DiscourseRedis
def self.raw_connection(config = nil)
config ||= self.config
redis_opts = {host: config['host'], port: config['port'], db: config['db']}
redis_opts[:password] = config['password'] if config['password']
Redis.new(redis_opts)
end
def self.config
YAML.load(ERB.new(File.new("#{Rails.root}/config/redis.yml").read).result)[Rails.env]
end
def initialize
@config = YAML.load(ERB.new(File.new("#{Rails.root}/config/redis.yml").read).result)[Rails.env]
redis_opts = {host: @config['host'], port: @config['port'], db: @config['db']}
redis_opts[:password] = @config['password'] if @config['password']
@redis = Redis.new(redis_opts)
@config = DiscourseRedis.config
@redis = DiscourseRedis.raw_connection(@config)
end
# prefix the key with the namespace