Class: ConsulService
- Inherits:
-
Object
- Object
- ConsulService
- Extended by:
- ConsulConfiguration
- Defined in:
- lib/consul/consul_service.rb
Constant Summary
Constants included from ConsulConfiguration
Instance Attribute Summary collapse
-
#consul_service_data ⇒ Object
Returns the value of attribute consul_service_data.
Instance Method Summary collapse
-
#initialize ⇒ ConsulService
constructor
A new instance of ConsulService.
- #start ⇒ Object
- #stop ⇒ Object
Methods included from ConsulConfiguration
Methods included from ApplicationConfiguration
Constructor Details
#initialize ⇒ ConsulService
Returns a new instance of ConsulService.
10 11 12 13 |
# File 'lib/consul/consul_service.rb', line 10 def initialize puts 'init consul' self.consul_service_data = ConsulService::configure end |
Instance Attribute Details
#consul_service_data ⇒ Object
Returns the value of attribute consul_service_data.
8 9 10 |
# File 'lib/consul/consul_service.rb', line 8 def consul_service_data @consul_service_data end |
Instance Method Details
#start ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/consul/consul_service.rb', line 15 def start puts 'start consul' if !consul_service_data consul_service_data = ConsulService::configure end Diplomat::Service.register(consul_service_data) end |
#stop ⇒ Object
23 24 25 26 |
# File 'lib/consul/consul_service.rb', line 23 def stop puts 'stop consul' Diplomat::Service.deregister(consul_service_data[:id]) end |