Method: Dendrite::Generators::Synapse#to_h

Defined in:
lib/dendrite/generators/synapse.rb

#to_hObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/dendrite/generators/synapse.rb', line 32

def to_h
  service_list = services.inject({}) do |hash, service|

    if read_only[service.name]
      data = service.to_h
      discovery_data = data[:discovery].merge({
        path: "/smartstack/services/#{service.organization}/#{service.component}/#{service.service.real_name}_readonly/instances"
      })
      data[:discovery] = discovery_data
      hash[service.name] = data
    else
      hash[service.name] = service.to_h
    end
    hash
  end

  {
    haproxy: Dendrite::Config.global_haproxy_config,
    file_output: {
      output_directory: '/tmp/synapse.config'
    }
  }.merge({services: service_list})
end