Class: Nonnative::ConfigurationProxy
- Inherits:
-
Object
- Object
- Nonnative::ConfigurationProxy
- 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
-
#host ⇒ String
Upstream host used by proxy implementations (defaults to ‘“127.0.0.1”`).
-
#kind ⇒ String
Proxy kind name (for example ‘“none”` or `“fault_injection”`).
-
#log ⇒ String?
Path to proxy log file (implementation-dependent).
-
#options ⇒ Hash
Proxy implementation options (implementation-dependent).
-
#port ⇒ Integer
Upstream port used by proxy implementations (defaults to ‘0`).
-
#wait ⇒ Numeric
Wait interval (seconds) after proxy state changes (defaults to ‘0.1`).
Instance Method Summary collapse
-
#initialize ⇒ void
constructor
Creates a proxy configuration with defaults.
Constructor Details
#initialize ⇒ void
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. = {} end |
Instance Attribute Details
#host ⇒ String
Returns 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 |
#kind ⇒ String
Returns proxy kind name (for example ‘“none”` or `“fault_injection”`).
18 19 20 |
# File 'lib/nonnative/configuration_proxy.rb', line 18 def kind @kind end |
#log ⇒ String?
Returns path to proxy log file (implementation-dependent).
27 28 29 |
# File 'lib/nonnative/configuration_proxy.rb', line 27 def log @log end |
#options ⇒ Hash
Returns proxy implementation options (implementation-dependent).
33 34 35 |
# File 'lib/nonnative/configuration_proxy.rb', line 33 def @options end |
#port ⇒ Integer
Returns upstream port used by proxy implementations (defaults to ‘0`).
24 25 26 |
# File 'lib/nonnative/configuration_proxy.rb', line 24 def port @port end |
#wait ⇒ Numeric
Returns 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 |