lib/routemaster/config.rb in routemaster-drain-1.1.0 vs lib/routemaster/config.rb in routemaster-drain-2.0.0
- old
+ new
@@ -22,9 +22,23 @@
def cache_redis
RedisBroker.instance.get(ENV.fetch('ROUTEMASTER_CACHE_REDIS'))
end
+ #
+ # 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 }
+ #
+ 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
+
def cache_expiry
Integer(ENV.fetch('ROUTEMASTER_CACHE_EXPIRY', 86_400 * 365))
end
def cache_auth