class Consul::Extensions::Base
Public Class Methods
new(options)
click to toggle source
Public: Constructor for this extension. Ensures a global unique ID for this client for a given namespace.
options - (Optional) Hash of Consul Client and extension options. options[:data_center] - (Optional) The Consul data center. Default: 'dc1'. options[:api_host] - (Optional) The Consul api host to request against. Default: '127.0.0.1'. options[:api_port] - (Optional) The Consul api port the api host is listening to. Default: '8500'. options[:version] - (Optional) The Consul API version to use. Default: 'v1'. options[:logger] - (Optional) The default logging mechanism. Default: Logger.new(STDOUT).
Extension instance capable of generating GUID.
# File lib/consul/extensions/base.rb, line 20 def initialize(options) options = {} if options.nil? @options = options.clone end
Protected Instance Methods
agent()
click to toggle source
extensions_namespace()
click to toggle source
Semantically private namespace for consul-ruby-client extensions.
# File lib/consul/extensions/base.rb, line 28 def extensions_namespace '.extensions' end
key_value_store()
click to toggle source
The Key Value Store to use.
# File lib/consul/extensions/base.rb, line 38 def key_value_store @kvs ||= KeyValue.new(options) end
logger()
click to toggle source
# File lib/consul/extensions/base.rb, line 46 def logger @logger ||= options[:logger] || Logger.new(STDOUT) end
session()
click to toggle source
# File lib/consul/extensions/base.rb, line 42 def session @session || Session.new(options) end
Private Instance Methods
options()
click to toggle source
TODO Add other clients here.
# File lib/consul/extensions/base.rb, line 54 def options @options end