protobuf-nats 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8941cd6d0acf196cafb26b994e7cb71156cc9ddf
4
- data.tar.gz: f87f6f7c86874688d94785e177e54f35950d91c7
3
+ metadata.gz: ee1af2d977263e468709cdfaa78d0d4819f0ae7e
4
+ data.tar.gz: fc9664c48ba9ac1dab3660d21011d87aac49c25e
5
5
  SHA512:
6
- metadata.gz: abdcc5311c25b5598a8bd73ec344ab3c12a8072f689a7473645e21e6ba61e477ede2e96deea566a4a15a0f3da0d8b27a3036ce062c497d487bbb7999158d5dd8
7
- data.tar.gz: f3dda5036de14aae93b0e07933897f835ad944c0e0798f9dc1b6a135bba83d7f82c2a8a265b45bf7c393dac013863519e89bc39315420c30269f8744459055b8
6
+ metadata.gz: f090b4fbeaa265db5e9c2694b1ebd9608209efd52d55a7af10719a4a0328ee9ba47eed27c246a21971e5f12640c320ef66ed3d5dcdb9c7cac88bfa87cec40d05
7
+ data.tar.gz: 5ae55860c6c42dae98c209e40508987c2fd505e733e6693cefabf718e3d9914c78779571aad8ce4addf7ce291c3a1c3aa1a9d5df2d372d670ca68ed88a26355e
data/README.md CHANGED
@@ -37,6 +37,8 @@ An example config looks like this:
37
37
  - "nats://127.0.0.1:4223"
38
38
  - "nats://127.0.0.1:4224"
39
39
  uses_tls: true
40
+ tls_client_cert: "/path/to/client-cert.pem"
41
+ tls_client_key: "/path/to/client-key.pem"
40
42
  connect_timeout: 2
41
43
  ```
42
44
 
@@ -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 || begin
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
 
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module Nats
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-nats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt