class Blinkist::Config::DiplomatAdapter
Public Class Methods
new(env, app_name)
click to toggle source
Calls superclass method
Blinkist::Config::Adapter::new
# File lib/blinkist/config/adapters/diplomat_adapter.rb, line 7 def initialize(env, app_name) super env, app_name @items_cache = {} Diplomat.configure do |config| config.url = "http://172.17.0.1:8500" end end
Public Instance Methods
get(key, default=nil, scope: nil)
click to toggle source
# File lib/blinkist/config/adapters/diplomat_adapter.rb, line 17 def get(key, default=nil, scope: nil) scope ||= @app_name diplomat_key = "#{scope}/#{key}" unless @items_cache.key? diplomat_key @items_cache[diplomat_key] = Diplomat::Kv.get(diplomat_key) end @items_cache[diplomat_key] rescue Diplomat::KeyNotFound default end