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, #wait

Instance Method Summary collapse

Constructor Details

#initializevoid

Creates a service configuration with defaults.



25
26
27
28
29
30
# File 'lib/nonnative/configuration_service.rb', line 25

def initialize
  super

  self.port = 0
  @proxy = Nonnative::ConfigurationProxy.new
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

#proxyNonnative::ConfigurationProxy

Proxy configuration for this service.



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

def proxy
  @proxy
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



58
59
60
# File 'lib/nonnative/configuration_service.rb', line 58

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



67
68
69
# File 'lib/nonnative/configuration_service.rb', line 67

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