Class: Dendrite::Generators::Nerve::ServiceConfig

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/dendrite/generators/nerve.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#serviceObject

Returns the value of attribute service

Returns:

  • (Object)

    the current value of service



23
24
25
# File 'lib/dendrite/generators/nerve.rb', line 23

def service
  @service
end

Instance Method Details

#to_hObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/dendrite/generators/nerve.rb', line 29

def to_h
  {
    host: Dendrite::Config.public_ip,
    port: service.service_port || DEFAULT_PORT,
    labels: {
      dc: Dendrite::Config.dc,
      env: Dendrite::Config.env
    }
  }.merge(zookeeper_config)
end

#zookeeper_configObject



40
41
42
43
44
45
46
# File 'lib/dendrite/generators/nerve.rb', line 40

def zookeeper_config
  {
    reporter_type: 'zookeeper',
    zk_hosts: Dendrite::Config.zk_hosts,
    zk_path: "/smartstack/services/#{organization}/#{component}/#{service.real_name}/instances"
  }
end