Class: Odania::Consul::Config

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

Instance Method Summary collapse

Instance Method Details

#delete(key) ⇒ Object



37
38
39
# File 'lib/odania/consul.rb', line 37

def delete(key)
	Diplomat::Kv.delete(key)
end

#get(path) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/odania/consul.rb', line 21

def get(path)
	begin
		JSON.parse Diplomat::Kv.get path
	rescue Diplomat::KeyNotFound
		nil
	end
end

#get_all(path) ⇒ Object



29
30
31
# File 'lib/odania/consul.rb', line 29

def get_all(path)
	retrieve_value path
end

#set(key, value) ⇒ Object



33
34
35
# File 'lib/odania/consul.rb', line 33

def set(key, value)
	Diplomat::Kv.put(key, JSON.dump(value))
end