Class: Glib::DynamicText::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/glib/dynamic_text/config.rb

Constant Summary collapse

@@redis =
nil
@@database_url =
nil

Class Method Summary collapse

Class Method Details

.database_urlObject



16
17
18
# File 'lib/glib/dynamic_text/config.rb', line 16

def self.database_url
  @@database_url ||= ENV['DT_DATABASE_URL']
end

.redisObject



7
8
9
10
11
12
13
14
# File 'lib/glib/dynamic_text/config.rb', line 7

def self.redis
  if @@redis.nil?
    redis_url = ENV.fetch('DT_REDIS_URL', 'redis://localhost:6379')
    # Allow application to specify their own $dt_redis
    @@redis = $dt_redis || Redis.new(url: redis_url)
  end
  @@redis
end