Class: Odania::Consul
- Inherits:
-
Object
- Object
- Odania::Consul
- Defined in:
- lib/odania/consul.rb
Defined Under Namespace
Classes: Config, Event, Health, Service
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#health ⇒ Object
readonly
Returns the value of attribute health.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(consul_url) ⇒ Consul
constructor
A new instance of Consul.
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/odania/consul.rb', line 3 def config @config end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
3 4 5 |
# File 'lib/odania/consul.rb', line 3 def event @event end |
#health ⇒ Object (readonly)
Returns the value of attribute health.
3 4 5 |
# File 'lib/odania/consul.rb', line 3 def health @health end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
3 4 5 |
# File 'lib/odania/consul.rb', line 3 def service @service end |