grenache-ruby-base 0.2.1 → 0.2.3

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: 8e1328d30d0bcdaf82f9284189fad8d3fa421677
4
- data.tar.gz: d0ca3f6002e055f723588ee1105d777a10e64b81
3
+ metadata.gz: d1c96976e6746b09a052fdf4016a9371a9616aa3
4
+ data.tar.gz: 5c5e291069a1d7556f9025ea3fe952f9ee905bec
5
5
  SHA512:
6
- metadata.gz: 4a52c4c939d04a236f1180748b60c8cebf2c33754c36ebc9a149c0a16521ffbe6f8289e1434b46b67727ecab577f0e1f3ffd6911a9b89187afc56e8f9f8e719a
7
- data.tar.gz: 002d0f740fd56696a5e25d14641c0f27550f897ddbd69b82bbae54ed012f1df0b5ff1ad9e69de17c41c3e9d25a13f369cbf9454f35643632db0b29e93af7226c
6
+ metadata.gz: f9570db0b3a42fd6704e6b317d5c596ca67700fb8a44d0489f1b098e0d2c79acea73b6d9674b084d0cc4584f8d9ad3df940a7e687099ee2ffd4bc5f7f7660f55
7
+ data.tar.gz: f9f50b6b02fcc263a15624469eb14768040cb426db551cbb8681cfcd9c548f71873be909ac4804b0899a7bcd910000290f737ee40f6b40213c35cf652a81c403
@@ -2,14 +2,50 @@ module Grenache
2
2
 
3
3
  # Encapsulate Configuration parameters
4
4
  class Configuration
5
- attr_accessor :grape_address, :auto_announce, :timeout, :auto_announce_interval
5
+ # grape configuration
6
+ attr_accessor :grape_address, :timeout
7
+
8
+ # service configuration parameters
9
+ attr_accessor :service_timeout, :auto_announce_interval, :auto_announce, :service_host
10
+
11
+ # service SSL specific configuration
12
+ # Cert is supposed to be PKCS12
13
+ attr_accessor :key, :cert_pem, :ca, :reject_unauthorized, :verify_mode
6
14
 
7
15
  # Initialize default values
8
16
  def initialize(params = {})
9
- self.grape_address = params[:grape_address] ? params[:grape_address] : "ws://127.0.0.1:30001"
10
- self.auto_announce = params[:auto_announce].nil? ? true : params[:auto_announce]
11
- self.auto_announce_interval = params[:auto_announce_interval] ? params[:auto_announce_interval] : 5
12
- self.timeout = params[:timeout] ? params[:timeout] : 5
17
+ set_val :grape_address, params, "ws://127.0.0.1:30001"
18
+ set_val :timeout, params, 5
19
+
20
+ set_val :auto_announce_interval, params, 5
21
+ set_bool :auto_announce, params, true
22
+ set_val :service_timeout, params, 5
23
+ set_val :service_host, params, "0.0.0.0"
24
+
25
+ set_val :key, params, nil
26
+ set_val :cert_pem, params, nil
27
+ set_val :ca, params, nil
28
+ set_val :reject_unauthorized, params, nil
29
+ set_val :verify_mode, params, Grenache::SSL_VERIFY_PEER
30
+ end
31
+
32
+ private
33
+ def set_bool(name, params, default)
34
+ method = "#{name}=".to_sym
35
+ if params[name].nil?
36
+ send(method, default)
37
+ else
38
+ send(method, params[name])
39
+ end
40
+ end
41
+
42
+ def set_val(name, params, default)
43
+ method = "#{name}=".to_sym
44
+ if params[name]
45
+ send(method, params[name])
46
+ else
47
+ send(method, default)
48
+ end
13
49
  end
14
50
  end
15
51
 
@@ -20,7 +56,7 @@ module Grenache
20
56
  end
21
57
 
22
58
  def config
23
- @configuration || self.class.config
59
+ self.class.config
24
60
  end
25
61
 
26
62
  module ClassMethods
@@ -0,0 +1,5 @@
1
+ module Grenache
2
+ SSL_VERIFY_NONE = 0
3
+ SSL_VERIFY_PEER = 1
4
+ SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Grenache
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -4,6 +4,7 @@ require 'faye/websocket'
4
4
  require 'httparty'
5
5
  require 'securerandom'
6
6
 
7
+ require 'grenache/ssl_verify'
7
8
  require 'grenache/configurable'
8
9
  require 'grenache/cache'
9
10
  require 'grenache/base'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grenache-ruby-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitfinex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-19 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -100,6 +100,7 @@ files:
100
100
  - lib/grenache/grape_message.rb
101
101
  - lib/grenache/link.rb
102
102
  - lib/grenache/service_message.rb
103
+ - lib/grenache/ssl_verify.rb
103
104
  - lib/grenache/version.rb
104
105
  homepage: https://github.com/bitfinexcom/grenache-ruby-base
105
106
  licenses:
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  version: '0'
122
123
  requirements: []
123
124
  rubyforge_project:
124
- rubygems_version: 2.6.11
125
+ rubygems_version: 2.4.5.1
125
126
  signing_key:
126
127
  specification_version: 4
127
128
  summary: Grenache Base Client implementation.