Class: Odania::Consul

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

Defined Under Namespace

Classes: Config, Event, Health, Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(consul_url) ⇒ Consul

Returns a new instance of Consul.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/odania/consul.rb', line 5

def initialize(consul_url)
	consul_url = ENV['CONSUL_ADDR'] if consul_url.nil?
	consul_url = 'http://consul:8500' if consul_url.nil?
	$logger.info "Consul URL: #{consul_url}" if $debug
	Diplomat.configure do |config|
		# Set up a custom Consul URL
		config.url = consul_url
	end

	@service = Service.new
	@config = Config.new
	@event = Event.new
	@health = Health.new
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/odania/consul.rb', line 3

def config
  @config
end

#eventObject (readonly)

Returns the value of attribute event.



3
4
5
# File 'lib/odania/consul.rb', line 3

def event
  @event
end

#healthObject (readonly)

Returns the value of attribute health.



3
4
5
# File 'lib/odania/consul.rb', line 3

def health
  @health
end

#serviceObject (readonly)

Returns the value of attribute service.



3
4
5
# File 'lib/odania/consul.rb', line 3

def service
  @service
end