ruby_eureka 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/bin/sidecar +3 -2
- data/bin/sidecar-1.0.jar +0 -0
- data/lib/eureka.rb +9 -0
- data/lib/eureka/execute.rb +6 -2
- data/lib/eureka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf87fcaf9dd300df93f7c440af812db8f37ba63
|
4
|
+
data.tar.gz: 02535e322400c3be8e2c2c69dea494af6060b01a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '093d1ed1e44da7e4cd7885a2f3e72a719a4d00940356ccc71275f701e76dc7394c461389c05a6ebf56c9e134840e4fd8fcbc9dcd4977e5fd6d934ebb1e868759'
|
7
|
+
data.tar.gz: 4122c206a08d707d6b00d1e99f9feb9e9733eb7964d06154248af662d02038d56ce05b3f639f08a0c34ab130257713b78203cb732f5507a1ede0bc52675a5cbe
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem '
|
10
|
+
gem 'ruby_eureka'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -28,6 +28,7 @@ Create YAML config files config/eureka_sidecar.yml
|
|
28
28
|
port: 3000 (Optional default to 3000)
|
29
29
|
sidecar:
|
30
30
|
port: 9091 (Optional default to 9090)
|
31
|
+
instance_id: service-a:9091 (Optional, required when register multiple instances of the same service)
|
31
32
|
|
32
33
|
Run the bundle exec command from the application root directory
|
33
34
|
|
data/bin/sidecar
CHANGED
@@ -10,8 +10,9 @@ opt = YAML.load(ERB.new(IO.read('config/eureka_sidecar.yml')).result) || opts
|
|
10
10
|
Eureka.setup do |config|
|
11
11
|
config.side_app_name = opt['eureka']['service_name']
|
12
12
|
config.eureka_url = opt['eureka']['url']
|
13
|
-
config.app_port = opt['service']['port']
|
14
|
-
config.sidecar_port = opt['sidecar']['port']
|
13
|
+
config.app_port = opt['service']['port'] if opt['service'] && opt['service']['port']
|
14
|
+
config.sidecar_port = opt['sidecar']['port'] if opt['sidecar'] && opt['sidecar']['port']
|
15
|
+
config.instance_id = opt['sidecar']['instance_id'] if opt['sidecar'] && opt['sidecar']['instance_id']
|
15
16
|
end
|
16
17
|
|
17
18
|
begin
|
data/bin/sidecar-1.0.jar
CHANGED
Binary file
|
data/lib/eureka.rb
CHANGED
@@ -49,12 +49,21 @@ module Eureka
|
|
49
49
|
@sidecar_port = sidecar_port
|
50
50
|
end
|
51
51
|
|
52
|
+
def self.instance_id
|
53
|
+
@instance_id
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.instance_id=(instance_id)
|
57
|
+
@instance_id = instance_id
|
58
|
+
end
|
59
|
+
|
52
60
|
# Default way to set up Euraka
|
53
61
|
def self.setup
|
54
62
|
yield self
|
55
63
|
end
|
56
64
|
|
57
65
|
def self.reset
|
66
|
+
@instance_id = nil
|
58
67
|
@side_app_name = nil
|
59
68
|
@eureka_url = nil
|
60
69
|
@jar = 'bin/sidecar-1.0.jar'
|
data/lib/eureka/execute.rb
CHANGED
@@ -15,15 +15,19 @@ module Eureka
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def options
|
18
|
-
%w[jar_path side_app_name eureka_url app_port sidecar_port].map do |option|
|
18
|
+
%w[jar_path side_app_name eureka_url app_port sidecar_port instance_id].map do |option|
|
19
19
|
send(option)
|
20
|
-
end.join(' ')
|
20
|
+
end.select{ |option| !option.to_s.strip.empty? }.join(' ')
|
21
21
|
end
|
22
22
|
|
23
23
|
def jar_path
|
24
24
|
Eureka.jar
|
25
25
|
end
|
26
26
|
|
27
|
+
def instance_id
|
28
|
+
"--instance-id=#{Eureka.instance_id}" if Eureka.instance_id
|
29
|
+
end
|
30
|
+
|
27
31
|
def sidecar_port
|
28
32
|
"--sidecar-port=#{Eureka.sidecar_port}"
|
29
33
|
end
|
data/lib/eureka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_eureka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jianbo Cui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|