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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1875fd7a6c301426bffec920bb6b226c7a6edbe
4
- data.tar.gz: de7a746ac5d82d2e467f90cb2b505911ddfae58d
3
+ metadata.gz: 0bf87fcaf9dd300df93f7c440af812db8f37ba63
4
+ data.tar.gz: 02535e322400c3be8e2c2c69dea494af6060b01a
5
5
  SHA512:
6
- metadata.gz: 78e0abca602b6f165006d6c8c5bbcf02b96e3a6384921d53d2f0d433a2a5cfa8e46a20e6af1bb8f7e1bfaa2dd6bc8b559b8fe6d73c411d9fca94e90e510c4c89
7
- data.tar.gz: d895d135fc294592909b98350b24d912d0cbdeb5f274120e67c5eb82354c5364ab29e12a3914107903f04f8aa61f3e6142f84119339e93c5de3ac157a76754ad
6
+ metadata.gz: '093d1ed1e44da7e4cd7885a2f3e72a719a4d00940356ccc71275f701e76dc7394c461389c05a6ebf56c9e134840e4fd8fcbc9dcd4977e5fd6d934ebb1e868759'
7
+ data.tar.gz: 4122c206a08d707d6b00d1e99f9feb9e9733eb7964d06154248af662d02038d56ce05b3f639f08a0c34ab130257713b78203cb732f5507a1ede0bc52675a5cbe
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_eureka (0.0.3)
4
+ ruby_eureka (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 'ruby-eureka'
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
 
@@ -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'] if opt['service'] && opt['service']['port']
14
- config.sidecar_port = opt['sidecar']['port'] if opt['sidecar'] && 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
Binary file
@@ -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'
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eureka
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
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.3
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 00:00:00.000000000 Z
11
+ date: 2018-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler