Class: Minke::Docker::ServiceDiscovery
- Inherits:
-
Object
- Object
- Minke::Docker::ServiceDiscovery
- Defined in:
- lib/minke/docker/service_discovery.rb
Overview
ServiceDiscovery allows you to look up the publicly accessible address and port for a server
Instance Method Summary collapse
-
#initialize(config) ⇒ ServiceDiscovery
constructor
A new instance of ServiceDiscovery.
-
#public_address_for(container_name, private_port, task) ⇒ Object
Will attempt to locate the public details for a running container given its name and private port Parameters: - container_name: the name of the running container - private_port: the private port which you wish to retrieve an address for - task: :run, :cucumber search either the run or cucumber section of the config.
Constructor Details
#initialize(config) ⇒ ServiceDiscovery
Returns a new instance of ServiceDiscovery.
6 7 8 9 |
# File 'lib/minke/docker/service_discovery.rb', line 6 def initialize config reader = Minke::Config::Reader.new @config = reader.read config end |
Instance Method Details
#public_address_for(container_name, private_port, task) ⇒ Object
Will attempt to locate the public details for a running container given its name and private port Parameters:
-
container_name: the name of the running container
-
private_port: the private port which you wish to retrieve an address for
-
task: :run, :cucumber search either the run or cucumber section of the config
18 19 20 21 |
# File 'lib/minke/docker/service_discovery.rb', line 18 def public_address_for container_name, private_port, task compose = Minke::Docker::DockerCompose.new @config.compose_file_for(task), Minke::Docker::SystemRunner.new compose.public_address container_name, private_port end |