Sha256: 8382b93a5d3f0e04539b2c63b3aa93dfdcf5c325a414b8c82d4ed668f7409a9f

Contents?: true

Size: 375 Bytes

Versions: 13

Compression:

Stored size: 375 Bytes

Contents

require 'redis'

module RedisConnection
  def self.connect(env)
    redis_config = YAML.load_file(File.join(Rails.root, "config", "redis.yml"))[env]
    raise 'RedisConnection can not connect because it is not configured' if redis_config.nil?

    $redis = Redis.new(:host => redis_config['host'], :port => redis_config['port'])
  end
end

RedisConnection.connect(Rails.env)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
config_manager-1.0.4 spec/dummy/config/initializers/redis.rb
config_manager-1.0.3 spec/dummy/config/initializers/redis.rb
config_manager-1.0.2 spec/dummy/config/initializers/redis.rb
config_manager-1.0.0 spec/dummy/config/initializers/redis.rb
config_manager-0.0.10 spec/dummy/config/initializers/redis.rb
config_manager-0.0.9 spec/dummy/config/initializers/redis.rb
config_manager-0.0.8 spec/dummy/config/initializers/redis.rb
config_manager-0.0.7 spec/dummy/config/initializers/redis.rb
config_manager-0.0.6 spec/dummy/config/initializers/redis.rb
config_manager-0.0.5 spec/dummy/config/initializers/redis.rb
config_manager-0.0.4 spec/dummy/config/initializers/redis.rb
config_manager-0.0.2 spec/dummy/config/initializers/redis.rb
config_manager-0.0.1 spec/dummy/config/initializers/redis.rb