Class: ConsulApplicationSettings::Providers::ConsulPreloaded

Inherits:
Abstract
  • Object
show all
Defined in:
lib/consul_application_settings/providers/consul_preloaded.rb

Overview

Provides access to settings stored in Consul. Loads them once

Instance Method Summary collapse

Constructor Details

#initialize(base_path, config) ⇒ ConsulPreloaded

Returns a new instance of ConsulPreloaded.



5
6
7
8
# File 'lib/consul_application_settings/providers/consul_preloaded.rb', line 5

def initialize(base_path, config)
  super
  @data = read_all_from_consul
end

Instance Method Details

#get(path) ⇒ Object



10
11
12
13
14
# File 'lib/consul_application_settings/providers/consul_preloaded.rb', line 10

def get(path)
  value = get_value_from_hash(absolute_key_path(path), @data)
  value = resolve_tree_response(value)
  ConsulApplicationSettings::Utils.cast_consul_value(value)
end