Class: Gorynich::Fetchers::Consul

Inherits:
Object
  • Object
show all
Defined in:
lib/gorynich/fetchers/consul.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(storage:, **opts) ⇒ Consul

Returns a new instance of Consul.



8
9
10
11
# File 'lib/gorynich/fetchers/consul.rb', line 8

def initialize(storage:, **opts)
  @storage = storage
  @consul_opts = opts
end

Instance Attribute Details

#consul_optsObject (readonly)

Returns the value of attribute consul_opts.



6
7
8
# File 'lib/gorynich/fetchers/consul.rb', line 6

def consul_opts
  @consul_opts
end

#storageObject (readonly)

Returns the value of attribute storage.



6
7
8
# File 'lib/gorynich/fetchers/consul.rb', line 6

def storage
  @storage
end

Instance Method Details

#fetchObject



13
14
15
16
# File 'lib/gorynich/fetchers/consul.rb', line 13

def fetch
  config = ::Diplomat::Kv.get_all(storage, convert_to_hash: true, **consul_opts)
  config.dig(*storage.split('/')) || {}
end