eureka_ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eureka_ruby/configuration.rb +2 -0
- data/lib/eureka_ruby/executor.rb +2 -0
- data/lib/eureka_ruby/http_client.rb +2 -0
- data/lib/eureka_ruby/middleware.rb +2 -0
- data/lib/eureka_ruby/railtie.rb +3 -1
- data/lib/eureka_ruby/version.rb +3 -1
- data/lib/eureka_ruby.rb +2 -1
- data/lib/generators/eureka_ruby/install_generator.rb +20 -0
- data/lib/generators/eureka_ruby/templates/eureka_ruby.rb +32 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 941cc4932d5adfc6ba5abb97cf648d02d29e3f6b8f99d7adf6c590d12af3ceac
|
4
|
+
data.tar.gz: 829bf70295eb12eabcf1714c1f7b7aac2694d17eba2e1e8a7fab9d5658ac429c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bd5840e19cab4b7c02186c1a8a2d298405d0da8c1bb1452edd25217707ee729495b9a2817830c87edf76b88007b404d1dddb3c3929d55e5ecfe2595fd9a9083
|
7
|
+
data.tar.gz: 6f736cb32d22c469a5fb832e7f568c9e53bb56fdfd2a170fdd2868061c480dba7add3d2528eab2b4bcb2ae1805a0e00df06097676e716bee1ac70be0075ad2d3
|
data/lib/eureka_ruby/executor.rb
CHANGED
data/lib/eureka_ruby/railtie.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# NOTE:
|
2
4
|
# https://github.com/Netflix/batch_request_api/blob/master/lib/batch_request_api/railtie.rb
|
3
5
|
module EurekaRuby
|
4
6
|
class Railtie < Rails::Railtie
|
5
7
|
config.app_middleware.insert 0, EurekaRuby::Middleware
|
6
8
|
end
|
7
|
-
end
|
9
|
+
end
|
data/lib/eureka_ruby/version.rb
CHANGED
data/lib/eureka_ruby.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'forwardable'
|
2
4
|
require 'eureka_ruby/middleware'
|
3
5
|
require 'eureka_ruby/configuration'
|
4
6
|
require 'eureka_ruby/executor'
|
5
7
|
require 'eureka_ruby/version'
|
6
|
-
require 'eureka_ruby/railtie' if defined?(Rails)
|
7
8
|
|
8
9
|
module EurekaRuby
|
9
10
|
class << self
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators/base'
|
4
|
+
|
5
|
+
module EurekaRuby
|
6
|
+
module Generators
|
7
|
+
# rails g eureka_ruby:install
|
8
|
+
class InstallGenerator < Rails::Generators::Base # :nodoc:
|
9
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
10
|
+
|
11
|
+
desc <<DESC
|
12
|
+
Description:
|
13
|
+
Copies EurekaRuby install file to your application's initializer directory.
|
14
|
+
DESC
|
15
|
+
def copy_install_file
|
16
|
+
template 'eureka_ruby.rb', 'config/initializers/eureka_ruby.rb'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if ENV['EUREKA']
|
4
|
+
require 'eureka_ruby/railtie'
|
5
|
+
EurekaRuby.configure do |config|
|
6
|
+
# Required
|
7
|
+
config.eureka_url = ENV['EUREKA_URL']
|
8
|
+
config.app_id = ENV['EUREKA_MS_APP_ID']
|
9
|
+
config.host_name = ENV['EUREKA_MS_HOST_NAME']
|
10
|
+
config.ip_addr = ENV['EUREKA_MS_IP_ADDR']
|
11
|
+
config.info_response = { "author" => "Tumayun", "language" => "Ruby" }
|
12
|
+
|
13
|
+
# Optional
|
14
|
+
config.port = ENV.fetch('EUREKA_MS_PORT', 3000).to_i # default 3000
|
15
|
+
config.scheme = ENV.fetch('EUREKA_MS_SCHEMA', 'http') # default http
|
16
|
+
config.health_path = ENV.fetch('EUREKA_MS_HEALTH_PATH', '/health') # default /health
|
17
|
+
config.health_response = 'OK' # default OK
|
18
|
+
config.health_headers = { "Content-Type" => "text/plain" } # default
|
19
|
+
config.info_path = ENV.fetch('EUREKA_MS_INFO_PATH', '/info') # default /info
|
20
|
+
end
|
21
|
+
|
22
|
+
# Register Instance
|
23
|
+
EurekaRuby.executor.run(:register)
|
24
|
+
|
25
|
+
# Keep Living
|
26
|
+
Thread.new do
|
27
|
+
loop do
|
28
|
+
EurekaRuby.executor.run(:send_heartbeat)
|
29
|
+
sleep ENV.fetch('EUREKA_HEARTBEAT_PERIOD', 10).to_i
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eureka_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 乌托邦科技
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- lib/eureka_ruby/middleware.rb
|
83
83
|
- lib/eureka_ruby/railtie.rb
|
84
84
|
- lib/eureka_ruby/version.rb
|
85
|
+
- lib/generators/eureka_ruby/install_generator.rb
|
86
|
+
- lib/generators/eureka_ruby/templates/eureka_ruby.rb
|
85
87
|
homepage: https://quanziapp.com
|
86
88
|
licenses:
|
87
89
|
- MIT
|