Class: Routemaster::Config

Inherits:
Object
  • Object
show all
Extended by:
Classmethods
Defined in:
lib/routemaster/config.rb

Defined Under Namespace

Modules: Classmethods

Instance Method Summary collapse

Methods included from Classmethods

method_missing, respond_to?

Instance Method Details

#cache_authObject



31
32
33
34
35
36
37
38
# File 'lib/routemaster/config.rb', line 31

def cache_auth
  Hashie::Rash.new.tap do |result|
    ENV.fetch('ROUTEMASTER_CACHE_AUTH', '').split(',').each do |entry|
      host, username, password = entry.split(':')
      result[Regexp.new(host)] = [username, password]
    end
  end
end

#cache_expiryObject



27
28
29
# File 'lib/routemaster/config.rb', line 27

def cache_expiry
  Integer(ENV.fetch('ROUTEMASTER_CACHE_EXPIRY', 86_400 * 365))
end

#cache_redisObject



23
24
25
# File 'lib/routemaster/config.rb', line 23

def cache_redis
  RedisBroker.instance.get(ENV.fetch('ROUTEMASTER_CACHE_REDIS'))
end

#drain_redisObject



19
20
21
# File 'lib/routemaster/config.rb', line 19

def drain_redis
  RedisBroker.instance.get(ENV.fetch('ROUTEMASTER_DRAIN_REDIS'))
end

#drain_tokensObject



44
45
46
# File 'lib/routemaster/config.rb', line 44

def drain_tokens
  Set.new(ENV.fetch('ROUTEMASTER_DRAIN_TOKENS').split(','))
end

#queue_nameObject



40
41
42
# File 'lib/routemaster/config.rb', line 40

def queue_name
  ENV.fetch('ROUTEMASTER_QUEUE_NAME', 'routemaster')
end

#url_expansionsObject



48
49
50
51
52
53
54
55
# File 'lib/routemaster/config.rb', line 48

def url_expansions
  Hashie::Rash.new.tap do |result|
    ENV.fetch('ROUTEMASTER_URL_EXPANSIONS', '').split(',').each do |entry|
      host, username, password = entry.split(':')
      result[Regexp.new(host)] = [username, password]
    end
  end
end