dryad-consul 0.2.3 → 0.2.5

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
  SHA256:
3
- metadata.gz: 07cd3118ee21cb1ee9bef8243d9db20787630ad0d6675c724a275e6627b9725d
4
- data.tar.gz: 8d94a70b7d56260a4c91d431e7ea5a6bc92af7f276b2c1e67d857d32063983f4
3
+ metadata.gz: c7ed3e76062a2b13385dfa1b93280032c1a2e4aa0147445b5d96caeb0ebbaa82
4
+ data.tar.gz: d4a8f9df580993a60d5780798feb2001bea85b0778878f1c721724a8f9e73eb6
5
5
  SHA512:
6
- metadata.gz: a28e53773a1512ccf578ae3427318b9dd65d40a44a01bf827168f3232ead502318ae62f2aff91e0d4e6a404979d53b384f6be2dea176ef6dd0b7d4b07451a3dd
7
- data.tar.gz: 2a0c0b87ea599010b00eac70a098dc722a250fa656ef2abc65c56ba3c7097e07076a6ee4a8093fd2b2e3643050e2fe2aee187c454f950f9bc631c291ecaf8e6a
6
+ metadata.gz: e414e663aa743ada8df13450fc9dcef4053791647358dce1270f3f624f2b9d96ccaebe5e69ebe6f4ca8da0176999a311e8261798b446e53c0f3dd120d1b64616
7
+ data.tar.gz: 40519c5de6ee81d8c28a35e17525e6159ad347490aafd2f70ea41e9b0f0394e70f80a76e1707aefa89e0cd7ae0134b02c5ff657c8c09656206ecff827dcc4c80
data/Gemfile.lock CHANGED
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dryad-consul (0.2.3)
4
+ dryad-consul (0.2.5)
5
5
  diplomat (~> 2.2, >= 2.2.4)
6
- dryad-core (= 0.2.3)
6
+ dryad-core (= 0.2.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  deep_merge (1.2.1)
12
12
  diff-lcs (1.3)
13
- diplomat (2.2.4)
13
+ diplomat (2.2.5)
14
14
  deep_merge (~> 1.0, >= 1.0.1)
15
15
  faraday (~> 0.9)
16
- dryad-core (0.2.3)
16
+ dryad-core (0.2.5)
17
17
  faraday (0.15.4)
18
18
  multipart-post (>= 1.2, < 3)
19
19
  multipart-post (2.1.1)
@@ -1,12 +1,12 @@
1
1
  require "rails"
2
+ require "dryad"
2
3
 
3
4
  module Dryad
4
5
  module Consul
5
6
  class Railtie < Rails::Railtie
6
7
  initializer "dryad_consul.set_consul" do
7
- ::Diplomat.configure do |config|
8
- config.url = "http://#{Dryad.configuration.consul[:host]}:#{Dryad.configuration.consul[:port]}"
9
- config.options = { headers: { "X-Consul-Token" => Dryad.configuration.consul[:token] } } if Dryad.configuration.consul[:token]
8
+ ActiveSupport.on_load(:dryad_consul) do
9
+ Dryad::Consul.configure_consul(Dryad.configuration)
10
10
  end
11
11
  end
12
12
 
@@ -18,8 +18,8 @@ module Dryad
18
18
  ActiveRecord::Base.establish_connection(Rails.env.to_sym)
19
19
  rescue Dryad::Core::ConfigurationNotFound => e
20
20
  raise e
21
- rescue e
22
- puts e.message
21
+ rescue Exception => e
22
+ Rails.logger.warn e.message
23
23
  end
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  module Dryad
2
2
  module Consul
3
- VERSION = '0.2.3'
3
+ VERSION = '0.2.5'
4
4
  end
5
5
  end
data/lib/dryad/consul.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "diplomat"
2
- require "dryad"
2
+ require "dryad/core"
3
3
  require "dryad/consul/railtie" if defined?(Rails)
4
4
  require "dryad/consul/version"
5
5
  require "dryad/consul/service_client"
@@ -11,5 +11,13 @@ require "dryad/consul/config_provider"
11
11
  module Dryad
12
12
  module Consul
13
13
  class Error < StandardError; end
14
+ class << self
15
+ def configure_consul(configuration)
16
+ ::Diplomat.configure do |config|
17
+ config.url = "http://#{configuration.consul[:host]}:#{configuration.consul[:port]}"
18
+ config.options = { headers: { "X-Consul-Token" => configuration.consul[:token] } } if configuration.consul[:token]
19
+ end
20
+ end
21
+ end
14
22
  end
15
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dryad-consul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pan Jie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-03 00:00:00.000000000 Z
11
+ date: 2019-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dryad-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.3
19
+ version: 0.2.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.3
26
+ version: 0.2.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: diplomat
29
29
  requirement: !ruby/object:Gem::Requirement