class ConsulApplicationSettings::Reader
Provides access to settings stored in Consul or in file system
Public Class Methods
new(base_path, config)
click to toggle source
# File lib/consul_application_settings/reader.rb, line 4 def initialize(base_path, config) @base_path = base_path @config = config @providers = config.settings_providers.map { |provider| provider.new(base_path, config) } end
Public Instance Methods
get(path)
click to toggle source
# File lib/consul_application_settings/reader.rb, line 10 def get(path) @providers.each do |provider| value = provider.get(path) return value unless value.nil? end nil end
Also aliased as: []
load(sub_path)
click to toggle source
# File lib/consul_application_settings/reader.rb, line 20 def load(sub_path) new_path = ConsulApplicationSettings::Utils.generate_path(@base_path, sub_path) self.class.new(new_path, @config) end