Class: Arf::Configuration
- Inherits:
-
Object
- Object
- Arf::Configuration
- Defined in:
- lib/arf/configuration.rb
Constant Summary collapse
- TLS_OPTS =
{ private_key_file: :tls_private_key_file, private_key: :tls_private_key, private_key_pass: :tls_private_key_pass, cert_chain_file: :tls_cert_chain_file, cert: :tls_cert, verify_peer: :tls_verify_peer, sni_hostname: :tls_sni_hostname, cipher_list: :tls_cipher_list, ssl_version: :tls_ssl_version, ecdh_curve: :tls_ecdh_curve, dhparam: :tls_dhparam, fail_if_no_peer_cert: :tls_fail_if_no_peer_cert }.freeze
Instance Attribute Summary collapse
-
#bind_address ⇒ Object
Returns the value of attribute bind_address.
-
#bind_port ⇒ Object
Returns the value of attribute bind_port.
-
#client_compression ⇒ Object
Returns the value of attribute client_compression.
-
#enable_tls ⇒ Object
Returns the value of attribute enable_tls.
-
#log_level ⇒ Object
Determines the log verbosity level.
- #logger ⇒ Object
-
#tls_cert ⇒ Object
Returns the value of attribute tls_cert.
-
#tls_cert_chain_file ⇒ Object
Returns the value of attribute tls_cert_chain_file.
-
#tls_cipher_list ⇒ Object
Returns the value of attribute tls_cipher_list.
-
#tls_dhparam ⇒ Object
Returns the value of attribute tls_dhparam.
-
#tls_ecdh_curve ⇒ Object
Returns the value of attribute tls_ecdh_curve.
-
#tls_fail_if_no_peer_cert ⇒ Object
Returns the value of attribute tls_fail_if_no_peer_cert.
-
#tls_private_key ⇒ Object
Returns the value of attribute tls_private_key.
-
#tls_private_key_file ⇒ Object
Returns the value of attribute tls_private_key_file.
-
#tls_private_key_pass ⇒ Object
Returns the value of attribute tls_private_key_pass.
-
#tls_sni_hostname ⇒ Object
Returns the value of attribute tls_sni_hostname.
-
#tls_ssl_version ⇒ Object
Returns the value of attribute tls_ssl_version.
-
#tls_verify_peer ⇒ Object
Returns the value of attribute tls_verify_peer.
Class Method Summary collapse
Instance Method Summary collapse
- #enable_tls? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #tls_configuration ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
37 38 39 40 41 |
# File 'lib/arf/configuration.rb', line 37 def initialize @bind_address = "127.0.0.1" @bind_port = 2730 @log_level = :info end |
Instance Attribute Details
#bind_address ⇒ Object
Returns the value of attribute bind_address.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def bind_address @bind_address end |
#bind_port ⇒ Object
Returns the value of attribute bind_port.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def bind_port @bind_port end |
#client_compression ⇒ Object
Returns the value of attribute client_compression.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def client_compression @client_compression end |
#enable_tls ⇒ Object
Returns the value of attribute enable_tls.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def enable_tls @enable_tls end |
#log_level ⇒ Object
Determines the log verbosity level. Valid options are:
-
:debug
-
:info (default)
-
:warn
-
:fatal
-
:error
35 36 37 |
# File 'lib/arf/configuration.rb', line 35 def log_level @log_level end |
#logger ⇒ Object
54 55 56 |
# File 'lib/arf/configuration.rb', line 54 def logger @logger ||= Logrb.new($stderr, level: @log_level) end |
#tls_cert ⇒ Object
Returns the value of attribute tls_cert.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_cert @tls_cert end |
#tls_cert_chain_file ⇒ Object
Returns the value of attribute tls_cert_chain_file.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_cert_chain_file @tls_cert_chain_file end |
#tls_cipher_list ⇒ Object
Returns the value of attribute tls_cipher_list.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_cipher_list @tls_cipher_list end |
#tls_dhparam ⇒ Object
Returns the value of attribute tls_dhparam.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_dhparam @tls_dhparam end |
#tls_ecdh_curve ⇒ Object
Returns the value of attribute tls_ecdh_curve.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_ecdh_curve @tls_ecdh_curve end |
#tls_fail_if_no_peer_cert ⇒ Object
Returns the value of attribute tls_fail_if_no_peer_cert.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_fail_if_no_peer_cert @tls_fail_if_no_peer_cert end |
#tls_private_key ⇒ Object
Returns the value of attribute tls_private_key.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_private_key @tls_private_key end |
#tls_private_key_file ⇒ Object
Returns the value of attribute tls_private_key_file.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_private_key_file @tls_private_key_file end |
#tls_private_key_pass ⇒ Object
Returns the value of attribute tls_private_key_pass.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_private_key_pass @tls_private_key_pass end |
#tls_sni_hostname ⇒ Object
Returns the value of attribute tls_sni_hostname.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_sni_hostname @tls_sni_hostname end |
#tls_ssl_version ⇒ Object
Returns the value of attribute tls_ssl_version.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_ssl_version @tls_ssl_version end |
#tls_verify_peer ⇒ Object
Returns the value of attribute tls_verify_peer.
20 21 22 |
# File 'lib/arf/configuration.rb', line 20 def tls_verify_peer @tls_verify_peer end |
Class Method Details
.instance ⇒ Object
63 64 65 |
# File 'lib/arf/configuration.rb', line 63 def self.instance @instance ||= new end |
Instance Method Details
#enable_tls? ⇒ Boolean
52 |
# File 'lib/arf/configuration.rb', line 52 def enable_tls? = enable_tls |
#tls_configuration ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/arf/configuration.rb', line 43 def tls_configuration return @tls_configuration unless @tls_configuration.nil? @tls_configuration = TLS_OPTS .map { |k, v| [k, send(v)] } .compact .to_h end |