dryad-consul 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/dryad/consul.rb +0 -1
- data/lib/dryad/consul/railtie.rb +9 -7
- data/lib/dryad/consul/service_registry.rb +2 -2
- data/lib/dryad/consul/version.rb +1 -1
- metadata +4 -5
- data/lib/dryad/consul/service_client.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d753817e009be98a773228e8b5fcf6c66636bec0f2e6baa70b1e01ad3ae45482
|
4
|
+
data.tar.gz: 856dd2ceb5bfb940b9ccb68153b5bb443e4ad5c2fb1a2163684d632777744511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 535f3a338b4022450d2d715759535e7951a3e325a8deb7fd5e061500bc30d74f4bf4c6bc528fe04c4c6a221197ab308bc2786a1d29ff636d29a694076bb05950
|
7
|
+
data.tar.gz: 48326d528f01eb302f9fd95570d144844c733a569054aac8c8b33cd3f6ccaa33670e499c9ea098dd6a5fe3fc23342adf907e7672c36e2fb880c5d870523bb75b
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dryad-consul (0.2.
|
4
|
+
dryad-consul (0.2.7)
|
5
5
|
diplomat (~> 2.2, >= 2.2.4)
|
6
|
-
dryad-core (= 0.2.
|
6
|
+
dryad-core (= 0.2.7)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
diplomat (2.2.5)
|
14
14
|
deep_merge (~> 1.0, >= 1.0.1)
|
15
15
|
faraday (~> 0.9)
|
16
|
-
dryad-core (0.2.
|
16
|
+
dryad-core (0.2.7)
|
17
17
|
faraday (0.15.4)
|
18
18
|
multipart-post (>= 1.2, < 3)
|
19
19
|
multipart-post (2.1.1)
|
data/lib/dryad/consul.rb
CHANGED
@@ -2,7 +2,6 @@ require "diplomat"
|
|
2
2
|
require "dryad/core"
|
3
3
|
require "dryad/consul/railtie" if defined?(Rails)
|
4
4
|
require "dryad/consul/version"
|
5
|
-
require "dryad/consul/service_client"
|
6
5
|
require "dryad/consul/service_registry"
|
7
6
|
require "dryad/consul/service"
|
8
7
|
require "dryad/consul/key_value_client"
|
data/lib/dryad/consul/railtie.rb
CHANGED
@@ -13,13 +13,15 @@ module Dryad
|
|
13
13
|
initializer "dryad_consul.update_active_record_connection" do
|
14
14
|
config.after_initialize do
|
15
15
|
db_path = "#{Dryad.configuration.namespace}/#{Dryad.configuration.group}/database.yml"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
begin
|
17
|
+
db_config = Dryad::Consul::ConfigProvider.load(db_path)
|
18
|
+
ActiveRecord::Base.configurations = YAML.load(ERB.new(db_config.payload).result)
|
19
|
+
ActiveRecord::Base.establish_connection(Rails.env.to_sym)
|
20
|
+
rescue Dryad::Core::ConfigurationNotFound => e
|
21
|
+
raise e
|
22
|
+
rescue Exception => e
|
23
|
+
Rails.logger.warn e.message
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -4,13 +4,13 @@ module Dryad
|
|
4
4
|
class << self
|
5
5
|
def register(service)
|
6
6
|
service.to_registers.each do |register|
|
7
|
-
|
7
|
+
::Diplomat::Service.register(register)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
def deregister(service)
|
12
12
|
service.portals.each do |portal|
|
13
|
-
|
13
|
+
::Diplomat::Service.deregister(portal.id)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/dryad/consul/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.7
|
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-
|
11
|
+
date: 2019-06-06 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.
|
19
|
+
version: 0.2.7
|
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.
|
26
|
+
version: 0.2.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: diplomat
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +108,6 @@ files:
|
|
108
108
|
- lib/dryad/consul/key_value_client.rb
|
109
109
|
- lib/dryad/consul/railtie.rb
|
110
110
|
- lib/dryad/consul/service.rb
|
111
|
-
- lib/dryad/consul/service_client.rb
|
112
111
|
- lib/dryad/consul/service_registry.rb
|
113
112
|
- lib/dryad/consul/version.rb
|
114
113
|
homepage: https://github.com/jack0pan/dryad.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Dryad
|
2
|
-
module Consul
|
3
|
-
class ServiceClient
|
4
|
-
class << self
|
5
|
-
def method_missing(name, *args, &block)
|
6
|
-
Diplomat::Service.send(name, *args, &block) || super
|
7
|
-
end
|
8
|
-
|
9
|
-
def respond_to_missing?(meth_id, with_private = false)
|
10
|
-
access_method?(meth_id) || super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|