Module: Nomad::Defaults
- Defined in:
- lib/nomad/defaults.rb
Constant Summary collapse
- NOMAD_ADDRESS =
The default nomad address.
"http://127.0.0.1:4646".freeze
- SSL_CIPHERS =
The list of SSL ciphers to allow. You should not change this value unless you absolutely know what you are doing!
"TLSv1.2:!aNULL:!eNULL".freeze
- RETRY_ATTEMPTS =
The default number of attempts.
2
- RETRY_BASE =
The default backoff interval.
0.05
- RETRY_MAX_WAIT =
The maximum amount of time for a single exponential backoff to sleep.
2.0
- DEFAULT_POOL_SIZE =
The default size of the connection pool
16
- RETRIED_EXCEPTIONS =
The set of exceptions that are detect and retried by default with ‘with_retries`
[HTTPServerError]
Class Method Summary collapse
-
.address ⇒ String
The address to communicate with Nomad.
-
.hostname ⇒ String?
The SNI host to use when connecting to Nomad via TLS.
-
.open_timeout ⇒ String?
The number of seconds to wait when trying to open a connection before timing out.
-
.options ⇒ Hash
The list of calculated options for this configurable.
-
.pool_size ⇒ Object
The size of the connection pool to communicate with Nomad.
-
.proxy_address ⇒ String?
The HTTP Proxy server address as a string.
-
.proxy_password ⇒ String?
The HTTP Proxy user password as a string.
-
.proxy_port ⇒ String?
The HTTP Proxy server port as a string.
-
.proxy_username ⇒ String?
The HTTP Proxy server username as a string.
-
.read_timeout ⇒ String?
The number of seconds to wait when reading a response before timing out.
-
.ssl_ca_cert ⇒ String?
The path to the CA cert on disk to use for certificate verification.
-
.ssl_ca_path ⇒ String?
The path to the directory on disk holding CA certs to use for certificate verification.
-
.ssl_cert_store ⇒ OpenSSL::X509::Store?
The CA cert store to use for certificate verification.
-
.ssl_ciphers ⇒ String
The ciphers that will be used when communicating with nomad over ssl You should only change the defaults if the ciphers are not available on your platform and you know what you are doing.
-
.ssl_pem_contents ⇒ String?
The raw contents (as a string) for the pem file.
-
.ssl_pem_file ⇒ String?
The path to a pem on disk to use with custom SSL verification.
-
.ssl_pem_passphrase ⇒ String?
Passphrase to the pem file on disk to use with custom SSL verification.
-
.ssl_timeout ⇒ String?
The number of seconds to wait for connecting and verifying SSL.
-
.ssl_verify ⇒ true, false
Verify SSL requests (default: true).
-
.timeout ⇒ String?
A default meta-attribute to set all timeout values - individually set timeout values will take precedence.
Class Method Details
.address ⇒ String
The address to communicate with Nomad.
41 42 43 |
# File 'lib/nomad/defaults.rb', line 41 def address ENV["NOMAD_ADDR"] || NOMAD_ADDRESS end |
.hostname ⇒ String?
The SNI host to use when connecting to Nomad via TLS.
47 48 49 |
# File 'lib/nomad/defaults.rb', line 47 def hostname ENV["NOMAD_TLS_SERVER_NAME"] end |
.open_timeout ⇒ String?
The number of seconds to wait when trying to open a connection before timing out
54 55 56 |
# File 'lib/nomad/defaults.rb', line 54 def open_timeout ENV["NOMAD_OPEN_TIMEOUT"] end |
.options ⇒ Hash
The list of calculated options for this configurable.
35 36 37 |
# File 'lib/nomad/defaults.rb', line 35 def Hash[*Configurable.keys.map { |key| [key, public_send(key)] }.flatten] end |
.pool_size ⇒ Object
The size of the connection pool to communicate with Nomad
60 61 62 63 64 65 66 |
# File 'lib/nomad/defaults.rb', line 60 def pool_size if var = ENV["NOMAD_POOL_SIZE"] return var.to_i else DEFAULT_POOL_SIZE end end |
.proxy_address ⇒ String?
The HTTP Proxy server address as a string
70 71 72 |
# File 'lib/nomad/defaults.rb', line 70 def proxy_address ENV["NOMAD_PROXY_ADDRESS"] end |
.proxy_password ⇒ String?
The HTTP Proxy user password as a string
82 83 84 |
# File 'lib/nomad/defaults.rb', line 82 def proxy_password ENV["NOMAD_PROXY_PASSWORD"] end |
.proxy_port ⇒ String?
The HTTP Proxy server port as a string
88 89 90 |
# File 'lib/nomad/defaults.rb', line 88 def proxy_port ENV["NOMAD_PROXY_PORT"] end |
.proxy_username ⇒ String?
The HTTP Proxy server username as a string
76 77 78 |
# File 'lib/nomad/defaults.rb', line 76 def proxy_username ENV["NOMAD_PROXY_USERNAME"] end |
.read_timeout ⇒ String?
The number of seconds to wait when reading a response before timing out
94 95 96 |
# File 'lib/nomad/defaults.rb', line 94 def read_timeout ENV["NOMAD_READ_TIMEOUT"] end |
.ssl_ca_cert ⇒ String?
The path to the CA cert on disk to use for certificate verification
128 129 130 |
# File 'lib/nomad/defaults.rb', line 128 def ssl_ca_cert ENV["NOMAD_CACERT"] end |
.ssl_ca_path ⇒ String?
The path to the directory on disk holding CA certs to use for certificate verification
141 142 143 |
# File 'lib/nomad/defaults.rb', line 141 def ssl_ca_path ENV["NOMAD_CAPATH"] end |
.ssl_cert_store ⇒ OpenSSL::X509::Store?
The CA cert store to use for certificate verification
134 135 136 |
# File 'lib/nomad/defaults.rb', line 134 def ssl_cert_store nil end |
.ssl_ciphers ⇒ String
The ciphers that will be used when communicating with nomad over ssl You should only change the defaults if the ciphers are not available on your platform and you know what you are doing
102 103 104 |
# File 'lib/nomad/defaults.rb', line 102 def ssl_ciphers ENV["NOMAD_SSL_CIPHERS"] || SSL_CIPHERS end |
.ssl_pem_contents ⇒ String?
The raw contents (as a string) for the pem file. To specify the path to the pem file, use #ssl_pem_file instead. This value is preferred over the value for #ssl_pem_file, if set.
110 111 112 |
# File 'lib/nomad/defaults.rb', line 110 def ssl_pem_contents ENV["NOMAD_SSL_PEM_CONTENTS"] end |
.ssl_pem_file ⇒ String?
The path to a pem on disk to use with custom SSL verification
116 117 118 |
# File 'lib/nomad/defaults.rb', line 116 def ssl_pem_file ENV["NOMAD_SSL_CERT"] || ENV["NOMAD_SSL_PEM_FILE"] end |
.ssl_pem_passphrase ⇒ String?
Passphrase to the pem file on disk to use with custom SSL verification
122 123 124 |
# File 'lib/nomad/defaults.rb', line 122 def ssl_pem_passphrase ENV["NOMAD_SSL_CERT_PASSPHRASE"] end |
.ssl_timeout ⇒ String?
The number of seconds to wait for connecting and verifying SSL
162 163 164 |
# File 'lib/nomad/defaults.rb', line 162 def ssl_timeout ENV["NOMAD_SSL_TIMEOUT"] end |
.ssl_verify ⇒ true, false
Verify SSL requests (default: true)
147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/nomad/defaults.rb', line 147 def ssl_verify # Nomad CLI uses this envvar, so accept it by precedence if !ENV["NOMAD_SKIP_VERIFY"].nil? return false end if ENV["NOMAD_SSL_VERIFY"].nil? true else %w[t y].include?(ENV["NOMAD_SSL_VERIFY"].downcase[0]) end end |
.timeout ⇒ String?
A default meta-attribute to set all timeout values - individually set timeout values will take precedence
169 170 171 |
# File 'lib/nomad/defaults.rb', line 169 def timeout ENV["NOMAD_TIMEOUT"] end |