Sha256: b56f6c91ab804b77fd13b5c5d5561a70fe5aa6bd40c972fbe0f0ef7ba10e45cb

Contents?: true

Size: 738 Bytes

Versions: 5

Compression:

Stored size: 738 Bytes

Contents

require 'redis'
require 'redis-namespace'

# docker links support
unless ENV['REDIS_PORT_6379_TCP_ADDR'].nil?
  ENV['REDIS_HOST'] = ENV['REDIS_PORT_6379_TCP_ADDR']
  ENV['REDIS_PORT'] = ENV['REDIS_PORT_6379_TCP_PORT']
  ENV.delete('REDIS_PASS')
end

ENV['REDIS_HOST'] = 'localhost' unless ENV['REDIS_HOST']
ENV['REDIS_PORT'] = '6379' unless ENV['REDIS_PORT']
ENV['REDIS_PASS'] = nil unless ENV['REDIS_PASS']
ENV['REDIS_DB'] = '0' unless ENV['REDIS_DB']

prefix = ENV.fetch('REDIS_PREFIX', 'gt')

conn = Redis.new(:host => ENV['REDIS_HOST'],
                 :port => ENV['REDIS_PORT'].to_i,
                 :password => ENV['REDIS_PASS'],
                 :db => ENV['REDIS_DB'].to_i)

$redis = Redis::Namespace.new(prefix, redis: conn)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gaptool-server-0.7.0 lib/helpers/redis.rb
gaptool-server-0.6.6 lib/helpers/redis.rb
gaptool-server-0.6.4 lib/helpers/redis.rb
gaptool-server-0.6.3 lib/helpers/redis.rb
gaptool-server-0.6.0 lib/helpers/redis.rb