Sha256: d4b7e57a746bbf3e3418f43d86d2cda83587472226c96b1003d53db8ba196d56

Contents?: true

Size: 1.53 KB

Versions: 56

Compression:

Stored size: 1.53 KB

Contents

redis_url = ENV["REDIS_URL"].present? ?  ENV["REDIS_URL"] : defined?(Rails.application.secrets.redis) ? Rails.application.secrets.redis : 'redis://localhost:6379/1'
resque_url = ENV["RESQUE_URL"].present? ?  ENV["RESQUE_URL"] : defined?(Rails.application.secrets.resque) ? Rails.application.secrets.resque : 'redis://localhost:6379/1'
flash_url = ENV["FLASH_URL"].present? ?  ENV["FLASH_URL"] : defined?(Rails.application.secrets.flash) ? Rails.application.secrets.flash : nil
browser_urls = {}
class RedisFlash
  def self.current
    @current ||= Redis.new()
  end
  def self.current=(redis)
    @current = redis
  end
end

if defined?(Redis.current)
  Redis.current = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'Redis')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
  browser_urls['Redis'] = { "url" => redis_url }
  if defined?(Resque.redis)
    if resque_url != redis_url
      Resque.redis = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'Resque')}", :url => resque_url, :timeout => 6, :reconnect_attempts => 2)
      browser_urls['Resque'] = { "url" => resque_url }
    else
      Resque.redis = Redis.current
    end
  end
  if defined?(flash_url.present?)
    RedisFlash.current = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'Flash')}", :url => flash_url, :timeout => 6, :reconnect_attempts => 2)
    browser_urls['Flash'] = { "url" => flash_url }
  end
end
if defined?(RedisBrowser)
  RedisBrowser.configure("connections" => browser_urls)
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
zuora_connect-3.1.0 config/initializers/redis.rb
zuora_connect-3.1.0.pre.g config/initializers/redis.rb
zuora_connect-3.1.0.pre.e config/initializers/redis.rb
zuora_connect-3.1.0.pre.d config/initializers/redis.rb
zuora_connect-3.1.0.pre.c config/initializers/redis.rb
zuora_connect-3.1.0.pre.b config/initializers/redis.rb
zuora_connect-3.1.0.pre.a config/initializers/redis.rb
zuora_connect-3.0.2.pre.r config/initializers/redis.rb
zuora_connect-3.0.2.pre.q config/initializers/redis.rb
zuora_connect-3.0.2.pre.p config/initializers/redis.rb
zuora_connect-3.0.2.pre.o config/initializers/redis.rb
zuora_connect-3.0.2.pre.n config/initializers/redis.rb
zuora_connect-3.0.2.pre.m config/initializers/redis.rb
zuora_connect-3.0.2.pre.l config/initializers/redis.rb
zuora_connect-3.0.2.pre.k config/initializers/redis.rb
zuora_connect-3.0.2.pre.j config/initializers/redis.rb
zuora_connect-3.0.2.pre.i config/initializers/redis.rb
zuora_connect-3.0.2.pre.h config/initializers/redis.rb
zuora_connect-3.0.2.pre.g config/initializers/redis.rb
zuora_connect-3.0.2.pre.f config/initializers/redis.rb