Class: Nonnative::ConfigurationProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/nonnative/configuration_proxy.rb

Overview

Proxy configuration attached to a service configuration.

A proxy allows you to interpose behavior between a client and a real service. For example, the built-in "fault_injection" proxy can close connections, introduce delays, or corrupt data for resilience testing.

This object is created automatically for each service via ConfigurationService. When kind is set to "none", no proxy is started and the service will use its configured host/port directly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializevoid

Creates a proxy configuration with defaults.

Defaults:

  • kind: "none"
  • host: "127.0.0.1"
  • port: 0
  • wait: 0.1
  • options: {}


45
46
47
48
49
50
51
# File 'lib/nonnative/configuration_proxy.rb', line 45

def initialize
  self.kind = 'none'
  self.host = '127.0.0.1'
  self.port = 0
  self.wait = 0.1
  self.options = {}
end

Instance Attribute Details

#hostString

Returns upstream host used by proxy implementations (defaults to "127.0.0.1").

Returns:

  • (String)

    upstream host used by proxy implementations (defaults to "127.0.0.1")



21
22
23
# File 'lib/nonnative/configuration_proxy.rb', line 21

def host
  @host
end

#kindString

Returns proxy kind name (for example "none" or "fault_injection").

Returns:

  • (String)

    proxy kind name (for example "none" or "fault_injection")



18
19
20
# File 'lib/nonnative/configuration_proxy.rb', line 18

def kind
  @kind
end

#logString?

Returns path to proxy log file (implementation-dependent).

Returns:

  • (String, nil)

    path to proxy log file (implementation-dependent)



27
28
29
# File 'lib/nonnative/configuration_proxy.rb', line 27

def log
  @log
end

#optionsHash

Returns proxy implementation options (implementation-dependent).

Returns:

  • (Hash)

    proxy implementation options (implementation-dependent)



33
34
35
# File 'lib/nonnative/configuration_proxy.rb', line 33

def options
  @options
end

#portInteger

Returns upstream port used by proxy implementations (defaults to 0).

Returns:

  • (Integer)

    upstream port used by proxy implementations (defaults to 0)



24
25
26
# File 'lib/nonnative/configuration_proxy.rb', line 24

def port
  @port
end

#waitNumeric

Returns wait interval (seconds) after proxy state changes (defaults to 0.1).

Returns:

  • (Numeric)

    wait interval (seconds) after proxy state changes (defaults to 0.1)



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

def wait
  @wait
end