Class: Wsv::TlsContext::Resolver
- Inherits:
-
Object
- Object
- Wsv::TlsContext::Resolver
- Defined in:
- lib/wsv/tls_context/resolver.rb
Constant Summary collapse
- XDG_DIR =
"wsv"- CERT_FILE =
"cert.pem"- KEY_FILE =
"key.pem"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cert_path: nil, key_path: nil) ⇒ Resolver
constructor
A new instance of Resolver.
- #resolve ⇒ Object
Constructor Details
#initialize(cert_path: nil, key_path: nil) ⇒ Resolver
Returns a new instance of Resolver.
16 17 18 19 |
# File 'lib/wsv/tls_context/resolver.rb', line 16 def initialize(cert_path: nil, key_path: nil) @cert_path = cert_path @key_path = key_path end |
Class Method Details
.resolve(cert_path: nil, key_path: nil) ⇒ Object
12 13 14 |
# File 'lib/wsv/tls_context/resolver.rb', line 12 def self.resolve(cert_path: nil, key_path: nil) new(cert_path: cert_path, key_path: key_path).resolve end |
Instance Method Details
#resolve ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wsv/tls_context/resolver.rb', line 21 def resolve return from_files(@cert_path, @key_path) if @cert_path && @key_path raise ArgumentError, "--cert and --key must be provided together" if @cert_path || @key_path xdg = xdg_pair return from_files(*xdg) if xdg ephemeral end |