Class: Orchestration::DockerCompose::RabbitMQService

Inherits:
Object
  • Object
show all
Includes:
ComposeHelpers
Defined in:
lib/orchestration/docker_compose/rabbitmq_service.rb

Instance Method Summary collapse

Methods included from ComposeHelpers

#networks, #sidecar_port

Constructor Details

#initialize(config, environment) ⇒ RabbitMQService

Returns a new instance of RabbitMQService.



8
9
10
11
# File 'lib/orchestration/docker_compose/rabbitmq_service.rb', line 8

def initialize(config, environment)
  @config = config
  @environment = environment
end

Instance Method Details

#definitionObject



13
14
15
16
17
# File 'lib/orchestration/docker_compose/rabbitmq_service.rb', line 13

def definition
  return nil unless @config.enabled?

  { 'image' => 'library/rabbitmq:management', 'networks' => networks }.merge(ports)
end

#portsObject



19
20
21
22
23
24
25
26
27
# File 'lib/orchestration/docker_compose/rabbitmq_service.rb', line 19

def ports
  return {} unless %i[development test].include?(@environment)

  container_port = Orchestration::Services::RabbitMQ::PORT
  management_port = Orchestration::Services::RabbitMQ::MANAGEMENT_PORT

  { 'ports' => ["#{sidecar_port(@environment)}#{container_port}",
                "#{sidecar_port(@environment)}#{management_port}"] }
end