Class: HermesAgent::Client::Configuration
- Inherits:
-
Object
- Object
- HermesAgent::Client::Configuration
- Defined in:
- lib/hermes_agent/client/configuration.rb
Overview
Connection settings for a HermesAgent::Client.
Holds the server location and credentials shared by all requests. An instance is created when a client is constructed and may be customized either via keyword arguments or by yielding the configuration to a block.
Constant Summary collapse
- DEFAULT_BASE_URL =
The default server root URL.
"http://127.0.0.1:8642"- DEFAULT_KEEP_ALIVE_TIMEOUT =
The default keep-alive timeout, in seconds.
5
Instance Attribute Summary collapse
-
#api_key ⇒ String?
The bearer token sent on every request, or
nilfor none. -
#base_url ⇒ String
The server root URL, without a path prefix.
-
#keep_alive_timeout ⇒ Numeric
How long, in seconds, an idle persistent connection may be reused before it is considered stale and reopened on the next request.
-
#open_timeout ⇒ Numeric?
The connection-open timeout in seconds, or
nilfor no client-side limit. -
#read_timeout ⇒ Numeric?
The read timeout in seconds, or
nilfor no client-side limit. -
#write_timeout ⇒ Numeric?
The request-write timeout in seconds, or
nilfor no client-side limit.
Instance Method Summary collapse
-
#initialize(base_url: DEFAULT_BASE_URL, api_key: ::ENV.fetch("HERMES_API_KEY", nil), read_timeout: nil, open_timeout: nil, write_timeout: nil, keep_alive_timeout: DEFAULT_KEEP_ALIVE_TIMEOUT) ⇒ Configuration
constructor
Create a configuration.
Constructor Details
#initialize(base_url: DEFAULT_BASE_URL, api_key: ::ENV.fetch("HERMES_API_KEY", nil), read_timeout: nil, open_timeout: nil, write_timeout: nil, keep_alive_timeout: DEFAULT_KEEP_ALIVE_TIMEOUT) ⇒ Configuration
Create a configuration.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hermes_agent/client/configuration.rb', line 44 def initialize(base_url: DEFAULT_BASE_URL, api_key: ::ENV.fetch("HERMES_API_KEY", nil), read_timeout: nil, open_timeout: nil, write_timeout: nil, keep_alive_timeout: DEFAULT_KEEP_ALIVE_TIMEOUT) @base_url = base_url @api_key = api_key @read_timeout = read_timeout @open_timeout = open_timeout @write_timeout = write_timeout @keep_alive_timeout = keep_alive_timeout end |
Instance Attribute Details
#api_key ⇒ String?
The bearer token sent on every request, or nil for none.
68 69 70 |
# File 'lib/hermes_agent/client/configuration.rb', line 68 def api_key @api_key end |
#base_url ⇒ String
The server root URL, without a path prefix.
62 63 64 |
# File 'lib/hermes_agent/client/configuration.rb', line 62 def base_url @base_url end |
#keep_alive_timeout ⇒ Numeric
How long, in seconds, an idle persistent connection may be reused before it is considered stale and reopened on the next request.
95 96 97 |
# File 'lib/hermes_agent/client/configuration.rb', line 95 def keep_alive_timeout @keep_alive_timeout end |
#open_timeout ⇒ Numeric?
The connection-open timeout in seconds, or nil for no client-side
limit.
81 82 83 |
# File 'lib/hermes_agent/client/configuration.rb', line 81 def open_timeout @open_timeout end |
#read_timeout ⇒ Numeric?
The read timeout in seconds, or nil for no client-side limit.
74 75 76 |
# File 'lib/hermes_agent/client/configuration.rb', line 74 def read_timeout @read_timeout end |
#write_timeout ⇒ Numeric?
The request-write timeout in seconds, or nil for no client-side
limit.
88 89 90 |
# File 'lib/hermes_agent/client/configuration.rb', line 88 def write_timeout @write_timeout end |