aggkit 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/bin/aggconsul +18 -4
- data/bin/aggwrap +16 -4
- data/lib/aggkit/runner.rb +6 -1
- data/lib/aggkit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69e17d1ded80e27c4244257dc58e1afc16a42dca6c77f25a5f8d1197f8eb2268
|
4
|
+
data.tar.gz: 77d0b795fc18f949a6192b90977d8d039615ea673cda1265f6306406bfeadb61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df85c38a96fbb362d9e2affc50675691bdce2dd42c605e3de27bbc6cf2c3aad0faacdc3071f7f7b63a4f085843fcb033bcaab1a9c72c04258f597f8d92b9eb4
|
7
|
+
data.tar.gz: abc055cf5ed28dfc5e75d0d81a8584131f1748a3daf23817a377e110d24c16367692c273e37dfad6b0d6003a3d90fbbb910f8ea99b16d3c800f93646adfa4f95
|
data/Gemfile
CHANGED
data/bin/aggconsul
CHANGED
@@ -8,7 +8,13 @@ require 'yaml'
|
|
8
8
|
STDOUT.sync = true
|
9
9
|
STDERR.sync = true
|
10
10
|
|
11
|
-
|
11
|
+
if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
|
12
|
+
ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
|
13
|
+
end
|
14
|
+
|
15
|
+
@opts = {
|
16
|
+
consul: ENV['CONSUL_HTTP_ADDR']
|
17
|
+
}
|
12
18
|
|
13
19
|
@opts[:exec] = (begin
|
14
20
|
ARGV.join(' ').split(' -- ')[1].strip
|
@@ -19,10 +25,14 @@ STDERR.sync = true
|
|
19
25
|
parser = OptionParser.new do |o|
|
20
26
|
o.banner = 'Usage: consul.rb [options] -- exec'
|
21
27
|
|
22
|
-
o.on('--consul url', 'Set up a custom Consul URL') do |
|
23
|
-
|
24
|
-
|
28
|
+
o.on('--consul url', 'Set up a custom Consul URL') do |consul|
|
29
|
+
if consul.to_s['http']
|
30
|
+
ENV['CONSUL_HTTP_ADDR'] = consul.to_s
|
31
|
+
else
|
32
|
+
ENV['CONSUL_HTTP_ADDR'] = "http://#{consul.to_s}:8500"
|
25
33
|
end
|
34
|
+
|
35
|
+
@opts[:consul] = ENV['CONSUL_HTTP_ADDR']
|
26
36
|
end
|
27
37
|
|
28
38
|
o.on('--token token', 'Connect into consul with custom access token (ACL)') do |token|
|
@@ -79,6 +89,10 @@ parser = OptionParser.new do |o|
|
|
79
89
|
end
|
80
90
|
parser.parse!
|
81
91
|
|
92
|
+
Diplomat.configure do |config|
|
93
|
+
config.url = @opts[:consul]
|
94
|
+
end
|
95
|
+
|
82
96
|
def die(message)
|
83
97
|
STDERR.puts "Error: #{message}"
|
84
98
|
exit 1
|
data/bin/aggwrap
CHANGED
@@ -54,10 +54,14 @@ STDOUT.sync
|
|
54
54
|
|
55
55
|
UTIL = File.basename(__FILE__)
|
56
56
|
|
57
|
+
if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
|
58
|
+
ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
|
59
|
+
end
|
60
|
+
|
57
61
|
@opts = {
|
58
62
|
service: ENV['AGGREDATOR_SERVICE'],
|
59
63
|
id: SecureRandom.hex(8),
|
60
|
-
consul: ENV['CONSUL_HTTP_ADDR']
|
64
|
+
consul: ENV['CONSUL_HTTP_ADDR'],
|
61
65
|
}
|
62
66
|
|
63
67
|
@opts[:exec] = (begin
|
@@ -79,10 +83,13 @@ parser = Aggkit::OptionParser.new do |o|
|
|
79
83
|
end
|
80
84
|
|
81
85
|
o.on("--consul=#{@opts[:consul]}", 'Set consul host. CONSUL_HOST env used when missed') do |consul|
|
82
|
-
|
83
|
-
|
84
|
-
|
86
|
+
if consul.to_s['http']
|
87
|
+
ENV['CONSUL_HTTP_ADDR'] = consul.to_s
|
88
|
+
else
|
89
|
+
ENV['CONSUL_HTTP_ADDR'] = "http://#{consul.to_s}:8500"
|
85
90
|
end
|
91
|
+
|
92
|
+
@opts[:consul] = ENV['CONSUL_HTTP_ADDR']
|
86
93
|
end
|
87
94
|
|
88
95
|
o.on('--http <PORT>', 'Create TTL consul check and pass http result to it') do |port|
|
@@ -107,6 +114,11 @@ die 'service name must be provided' if @opts[:service].to_s.empty?
|
|
107
114
|
|
108
115
|
die 'script must be provided' if @opts[:exec].empty?
|
109
116
|
|
117
|
+
|
118
|
+
Diplomat.configure do |config|
|
119
|
+
config.url = @opts[:consul]
|
120
|
+
end
|
121
|
+
|
110
122
|
SERVICE_ID = "#{@opts[:service]}_#{@opts[:id]}".freeze
|
111
123
|
|
112
124
|
@service = {
|
data/lib/aggkit/runner.rb
CHANGED
@@ -36,7 +36,12 @@ module Aggkit
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def load_envs_from_consul(consul, service)
|
39
|
-
|
39
|
+
consul_http = consul['http']
|
40
|
+
consul
|
41
|
+
else
|
42
|
+
"http://#{consul}:8500"
|
43
|
+
end
|
44
|
+
envs = execute!("aggconsul --consul=#{consul_http} --env services/env/#{service} --pristine -d", "Can't load envs")
|
40
45
|
load_envs(envs)
|
41
46
|
end
|
42
47
|
|
data/lib/aggkit/version.rb
CHANGED