Class: Nonnative::ConfigurationService

Inherits:
ConfigurationRunner show all
Defined in:
lib/nonnative/configuration_service.rb

Overview

Service-specific configuration.

A “service” is proxy-only: it does not start a Ruby thread or OS process. It exists so Nonnative can start and control a proxy in front of an external dependency.

Instances are usually created through Nonnative::Configuration#service.

Instance Attribute Summary collapse

Attributes inherited from ConfigurationRunner

#host, #name, #proxy, #wait

Instance Method Summary collapse

Constructor Details

#initializevoid

Creates a service configuration with defaults.



20
21
22
23
24
# File 'lib/nonnative/configuration_service.rb', line 20

def initialize
  super

  self.port = 0
end

Instance Attribute Details

#portInteger

Returns client-facing port used by the service proxy.

Returns:

  • (Integer)

    client-facing port used by the service proxy



15
16
17
# File 'lib/nonnative/configuration_service.rb', line 15

def port
  @port
end

Instance Method Details

#portsvoid

This method returns an undefined value.

Services expose a single proxy listener, so plural runner ports are not supported.

Raises:

  • (ArgumentError)

    when plural service ports are read



30
31
32
# File 'lib/nonnative/configuration_service.rb', line 30

def ports
  raise ArgumentError, "Use 'port' instead of 'ports' for service '#{name}'"
end

#ports=(_value) ⇒ void

This method returns an undefined value.

Services expose a single proxy listener, so plural runner ports are not supported.

Parameters:

  • _value (Array<Integer>)

    ignored plural ports

Raises:

  • (ArgumentError)

    when plural service ports are assigned



39
40
41
# File 'lib/nonnative/configuration_service.rb', line 39

def ports=(_value)
  raise ArgumentError, "Use 'port' instead of 'ports' for service '#{name}'"
end