Sha256: 1d2e43cd577e2c48448f48702370cd36f45a2e7908493db416d2ef04c7e5dab8

Contents?: true

Size: 513 Bytes

Versions: 28

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module Orchestration
  module DockerCompose
    module ComposeHelpers
      def sidecar_port(environment)
        port = Orchestration.random_local_port
        return "#{port}:" unless environment == :test

        # If env var `sidecar` is not set then ports will be configured as e.g.:
        # "50123:3306"
        # otherwise it will be:
        # "3306" (docker will use an ephemeral host port which we will not use)
        "${sidecar-#{port}:}"
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
orchestration-0.6.4 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.6.3 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.6.2 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.6.1 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.6.0 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.14 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.13 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.12 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.11 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.10 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.9 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.8 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.7 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.6 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.5 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.4 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.3 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.2 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.1 lib/orchestration/docker_compose/compose_helpers.rb
orchestration-0.5.0 lib/orchestration/docker_compose/compose_helpers.rb