Class: Routemaster::Config
- Inherits:
-
Object
- Object
- Routemaster::Config
show all
- Extended by:
- Classmethods
- Includes:
- Singleton
- Defined in:
- lib/routemaster/config.rb
Defined Under Namespace
Modules: Classmethods
Instance Attribute Summary collapse
Instance Method Summary
collapse
method_missing, respond_to?
Instance Attribute Details
#logger ⇒ Object
23
24
25
|
# File 'lib/routemaster/config.rb', line 23
def logger
@logger ||= NullLogger.new
end
|
Instance Method Details
#cache_auth ⇒ Object
56
57
58
59
60
61
62
63
|
# File 'lib/routemaster/config.rb', line 56
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_expiry ⇒ Object
49
50
51
52
53
54
|
# File 'lib/routemaster/config.rb', line 49
def cache_expiry
Integer(ENV.fetch('ROUTEMASTER_CACHE_EXPIRY', 86_400 * 90))
end
|
#cache_redis ⇒ Object
31
32
33
|
# File 'lib/routemaster/config.rb', line 31
def cache_redis
RedisBroker.instance.get(:cache_redis, urls: ENV.fetch('ROUTEMASTER_CACHE_REDIS', '').split(','))
end
|
#drain_redis ⇒ Object
27
28
29
|
# File 'lib/routemaster/config.rb', line 27
def drain_redis
RedisBroker.instance.get(:drain_redis, urls: ENV.fetch('ROUTEMASTER_DRAIN_REDIS', '').split(','))
end
|
#drain_tokens ⇒ Object
73
74
75
|
# File 'lib/routemaster/config.rb', line 73
def drain_tokens
Set.new(ENV.fetch('ROUTEMASTER_DRAIN_TOKENS').split(','))
end
|
#hosts ⇒ Object
Given an ENV format of service:service_root_url,other_service:other_service_root_url
Generate a hash of { service => service_root_url, other_service => other_service_root_url }
39
40
41
42
43
44
45
46
47
|
# File 'lib/routemaster/config.rb', line 39
def hosts
@hosts ||= begin
hosts = ENV['ROUTEMASTER_DRAIN_HOSTS'].split(',')
hosts.inject({}) do |res, host|
key, val = host.split(':')
res.merge(key => val)
end
end
end
|
#queue_adapter ⇒ Object
65
66
67
|
# File 'lib/routemaster/config.rb', line 65
def queue_adapter
ENV.fetch('ROUTEMASTER_QUEUE_ADAPTER', 'resque').to_sym
end
|
#queue_name ⇒ Object
69
70
71
|
# File 'lib/routemaster/config.rb', line 69
def queue_name
ENV.fetch('ROUTEMASTER_QUEUE_NAME', 'routemaster')
end
|