protobuf-nats 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/protobuf/nats/config.rb +8 -4
- data/lib/protobuf/nats/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1af2d977263e468709cdfaa78d0d4819f0ae7e
|
4
|
+
data.tar.gz: fc9664c48ba9ac1dab3660d21011d87aac49c25e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f090b4fbeaa265db5e9c2694b1ebd9608209efd52d55a7af10719a4a0328ee9ba47eed27c246a21971e5f12640c320ef66ed3d5dcdb9c7cac88bfa87cec40d05
|
7
|
+
data.tar.gz: 5ae55860c6c42dae98c209e40508987c2fd505e733e6693cefabf718e3d9914c78779571aad8ce4addf7ce291c3a1c3aa1a9d5df2d372d670ca68ed88a26355e
|
data/README.md
CHANGED
data/lib/protobuf/nats/config.rb
CHANGED
@@ -4,14 +4,16 @@ require "yaml"
|
|
4
4
|
module Protobuf
|
5
5
|
module Nats
|
6
6
|
class Config
|
7
|
-
attr_accessor :uses_tls, :servers, :connect_timeout
|
7
|
+
attr_accessor :uses_tls, :servers, :connect_timeout, :tls_client_cert, :tls_client_key
|
8
8
|
|
9
9
|
CONFIG_MUTEX = ::Mutex.new
|
10
10
|
|
11
11
|
DEFAULTS = {
|
12
|
-
:uses_tls => false,
|
13
12
|
:connect_timeout => nil,
|
14
|
-
:servers => nil
|
13
|
+
:servers => nil,
|
14
|
+
:tls_client_cert => nil,
|
15
|
+
:tls_client_key => nil,
|
16
|
+
:uses_tls => false,
|
15
17
|
}.freeze
|
16
18
|
|
17
19
|
def initialize
|
@@ -48,7 +50,7 @@ module Protobuf
|
|
48
50
|
|
49
51
|
def connection_options(reload = false)
|
50
52
|
@connection_options = false if reload
|
51
|
-
@connection_options
|
53
|
+
@connection_options ||= begin
|
52
54
|
options = {
|
53
55
|
servers: servers,
|
54
56
|
connect_timeout: connect_timeout
|
@@ -61,6 +63,8 @@ module Protobuf
|
|
61
63
|
def new_tls_context
|
62
64
|
tls_context = ::OpenSSL::SSL::SSLContext.new
|
63
65
|
tls_context.ssl_version = :TLSv1_2
|
66
|
+
tls_context.cert = ::OpenSSL::X509::Certificate.new(::File.read(tls_client_cert)) if tls_client_cert
|
67
|
+
tls_context.key = ::OpenSSL::PKey::RSA.new(::File.read(tls_client_key)) if tls_client_key
|
64
68
|
tls_context
|
65
69
|
end
|
66
70
|
|