aggkit 0.4.5.12925 → 0.4.6.12955

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3950616bd877f083d95f58db6c1a5eb033ffe375be3b80d7b92c24bb309beb86
4
- data.tar.gz: d6b2b40d76a67e9e6f630fafc8d6739a0ceac1374c364fce76b875b199aa60bc
3
+ metadata.gz: f7e48a17865dea2099b262c9a3934107b47d9274be7892580b534901cec2a80c
4
+ data.tar.gz: 4a96b03153abeb1cbeea5e71720435a7b78893643bed5b674983b8a4d00c4ff6
5
5
  SHA512:
6
- metadata.gz: 9dd3a92b921e51cd9292caf4f02eb450fc992fb25d779a46d3942630d5f47b7a98f688374b117bae4f4fb440a493003db6ffe4d0f408ca83f758442e23b6abdf
7
- data.tar.gz: 460930faa6ebf351b2001a5f58caed260f2ea505284580e148f8279e6d38ffb902094e5f4a765341691cda9165fd888e810db882e9b460142ebd66398d6f8f62
6
+ metadata.gz: 7cfbb8df979355eeaab4465281b0e99a51132fea3016d906562a5a7553ad0d9d760f78b4f375caadb9ec29553a4c160f9f514c4f1bffd0f0957611e37da58a1d
7
+ data.tar.gz: ec94c2f93f729393901884989729fe778c1f949698ca7d7cf9c5960b792bd4f7696652341ea86b194571d638b5249fed40ebd04a87c8461151dbdbe6dbfe84ba
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aggkit (0.4.5.12925)
4
+ aggkit (0.4.6.12955)
5
5
  diplomat
6
6
  dotenv
7
7
  json
data/bin/aggconsul CHANGED
@@ -4,17 +4,14 @@ require 'diplomat'
4
4
  require 'optparse'
5
5
  require 'English'
6
6
  require 'yaml'
7
+ require 'aggkit'
7
8
 
8
9
  STDOUT.sync = true
9
10
  STDERR.sync = true
10
11
 
11
- if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
12
- ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
13
- end
12
+ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], host: ENV['CONSUL_HOST'], port: ENV['CONSUL_PORT'])
14
13
 
15
- @opts = {
16
- consul: ENV['CONSUL_HTTP_ADDR']
17
- }
14
+ @opts = {}
18
15
 
19
16
  UTIL = File.basename(__FILE__)
20
17
 
@@ -27,14 +24,16 @@ UTIL = File.basename(__FILE__)
27
24
  parser = OptionParser.new do |o|
28
25
  o.banner = "Usage: #{UTIL} [options] -- exec"
29
26
 
30
- o.on('--consul url', 'Set up a custom Consul URL') do |consul|
31
- ENV['CONSUL_HTTP_ADDR'] = if consul.to_s['http']
32
- consul.to_s
33
- else
34
- "http://#{consul}:8500"
35
- end
27
+ o.on("--consul=#{consul_addr}", 'Set a fully qualified Consul URL. Take precendance') do |addr|
28
+ @opts[:consul_addr] = Aggkit::Consul.consul_addr(addr.to_s.strip)
29
+ end
30
+
31
+ o.on("--consul-host=#{consul_addr.host}", 'Set consul host. Ignored when consul specified') do |host|
32
+ @opts[:consul_host] = host.to_s.strip
33
+ end
36
34
 
37
- @opts[:consul] = ENV['CONSUL_HTTP_ADDR']
35
+ o.on("--consul-port=#{consul_addr.port}", 'Set consul port. Ignored when consul specified') do |port|
36
+ @opts[:consul_port] = port.to_s.strip
38
37
  end
39
38
 
40
39
  o.on('--token token', 'Connect into consul with custom access token (ACL)') do |token|
@@ -91,6 +90,19 @@ parser = OptionParser.new do |o|
91
90
  end
92
91
  parser.parse!
93
92
 
93
+ consul_addr = if !@opts[:consul_addr].to_s.empty?
94
+ Aggkit::Consul.build_consul_addr(addr: @opts[:consul_addr].to_s, host: nil, port: nil).to_s
95
+ elsif !@opts[:consul_host].to_s.empty? || !@opts[:consul_port].to_s.empty?
96
+ Aggkit::Consul.build_consul_addr(addr: nil, host: @opts[:consul_host], port: opts[:consul_port]).to_s
97
+ else
98
+ consul_addr
99
+ end
100
+
101
+ @opts[:consul] = consul_addr.to_s
102
+ ENV['CONSUL_HTTP_ADDR'] = consul_addr.to_s
103
+ ENV['CONSUL_HOST'] = consul_addr.host.to_s
104
+ ENV['CONSUL_PORT'] = consul_addr.port.to_s
105
+
94
106
  Diplomat.configure do |config|
95
107
  config.url = @opts[:consul]
96
108
  end
@@ -117,16 +129,16 @@ def dereferenced_value(value)
117
129
  end
118
130
  end
119
131
 
120
- if config = @opts[:config]
132
+ if (config = @opts[:config])
121
133
  @opts[:config] = YAML.load(config == '-' ? STDIN.read : File.read(config))
122
134
  end
123
135
 
124
136
  if @opts[:init]
125
137
  raise OptionParser::MissingArgument.new('config') unless @opts[:config]
126
138
 
127
- services = if service = @opts[:service]
139
+ services = if (srv = @opts[:service])
128
140
  {
129
- service => @opts[:config][service]
141
+ srv => @opts[:config][srv]
130
142
  }
131
143
  else
132
144
  @opts[:config]
@@ -162,8 +174,8 @@ end
162
174
  if @opts[:show]
163
175
  config = {}
164
176
 
165
- path = if service = @opts[:service]
166
- "services/env/#{service}/"
177
+ path = if (srv = @opts[:service])
178
+ "services/env/#{srv}/"
167
179
  else
168
180
  'services/env/'
169
181
  end
@@ -187,7 +199,7 @@ if @opts[:show]
187
199
  exit 0
188
200
  end
189
201
 
190
- if put = @opts[:put]
202
+ if (put = @opts[:put])
191
203
  path, *value = put.split(':').map(&:strip)
192
204
  value = value.join(':')
193
205
  value = File.read(value) if @opts[:upload] && value && File.exist?(value)
@@ -197,7 +209,7 @@ if put = @opts[:put]
197
209
  exit 0
198
210
  end
199
211
 
200
- if path = @opts[:get]
212
+ if (path = @opts[:get])
201
213
  value = dereferenced_value(Diplomat::Kv.get(path))
202
214
 
203
215
  STDOUT.puts value.to_s.strip
@@ -205,7 +217,7 @@ if path = @opts[:get]
205
217
  exit 0
206
218
  end
207
219
 
208
- if prefix = @opts[:env]
220
+ if (prefix = @opts[:env])
209
221
  keys = begin
210
222
  Diplomat::Kv.get(prefix, keys: true)
211
223
  rescue Diplomat::KeyNotFound => e
@@ -220,7 +232,7 @@ if prefix = @opts[:env]
220
232
  e.merge(key_to_env(key.gsub(prefix, '')) => value)
221
233
  end
222
234
 
223
- if cmd = @opts[:exec]
235
+ if (cmd = @opts[:exec])
224
236
  env = ENV.to_h.merge(env) unless @opts[:pristine]
225
237
 
226
238
  exec(env, cmd, unsetenv_others: true)
data/bin/aggexec CHANGED
@@ -4,12 +4,10 @@ require 'aggkit'
4
4
 
5
5
  UTIL = File.basename(__FILE__)
6
6
 
7
- if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
8
- ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
9
- end
7
+ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], host: ENV['CONSUL_HOST'], port: ENV['CONSUL_PORT'])
8
+
10
9
 
11
10
  @opts = {
12
- consul: ENV['CONSUL_HTTP_ADDR'],
13
11
  depends: [],
14
12
  prefixes: [],
15
13
  templates: []
@@ -25,9 +23,16 @@ end
25
23
  parser = Aggkit::OptionParser.new do |o|
26
24
  o.banner = "Usage: #{UTIL} [options] -- exec"
27
25
 
28
- o.on("--consul=#{@opts[:consul]}", 'Set consul http address. CONSUL_HTTP_ADDR env can be used instead') do |consul|
29
- ENV['CONSUL_HTTP_ADDR'] = Aggkit::Consul.consul_addr(consul)
30
- @opts[:consul] = ENV['CONSUL_HTTP_ADDR']
26
+ o.on("--consul=#{consul_addr}", 'Set a fully qualified Consul URL. Take precendance') do |addr|
27
+ @opts[:consul_addr] = Aggkit::Consul.consul_addr(addr.to_s.strip)
28
+ end
29
+
30
+ o.on("--consul-host=#{consul_addr.host}", 'Set consul host. Ignored when consul specified') do |host|
31
+ @opts[:consul_host] = host.to_s.strip
32
+ end
33
+
34
+ o.on("--consul-port=#{consul_addr.port}", 'Set consul port. Ignored when consul specified') do |port|
35
+ @opts[:consul_port] = port.to_s.strip
31
36
  end
32
37
 
33
38
  o.on('--depends=mq,db,router...', 'Set list of services to wait for ready before start') do |list|
@@ -52,13 +57,24 @@ parser = Aggkit::OptionParser.new do |o|
52
57
  end
53
58
  parser.parse!
54
59
 
60
+ consul_addr = if !@opts[:consul_addr].to_s.empty?
61
+ Aggkit::Consul.build_consul_addr(addr: @opts[:consul_addr].to_s, host: nil, port: nil).to_s
62
+ elsif !@opts[:consul_host].to_s.empty? || !@opts[:consul_port].to_s.empty?
63
+ Aggkit::Consul.build_consul_addr(addr: nil, host: @opts[:consul_host], port: opts[:consul_port]).to_s
64
+ else
65
+ consul_addr
66
+ end
67
+
68
+ @opts[:consul] = consul_addr.to_s
69
+ ENV['CONSUL_HTTP_ADDR'] = consul_addr.to_s
70
+ ENV['CONSUL_HOST'] = consul_addr.host.to_s
71
+ ENV['CONSUL_PORT'] = consul_addr.port.to_s
72
+
55
73
  @opts[:depends] = @opts[:depends].reject(&:empty?)
56
74
  @opts[:prefixes] = @opts[:prefixes].reject(&:empty?)
57
75
  @opts[:templates] = @opts[:templates].reject(&:empty?)
58
76
 
59
- if @opts[:exec].empty? && !@opts[:noexec]
60
- Aggkit::Exec.die 'exec script must be provided'
61
- end
77
+ Aggkit::Exec.die 'exec script must be provided' if @opts[:exec].empty? && !@opts[:noexec]
62
78
 
63
79
  if @opts[:depends].any? || @opts[:prefixes].any?
64
80
  # Wait for consul
data/bin/agglock CHANGED
@@ -3,8 +3,10 @@
3
3
  require 'optparse'
4
4
  require 'diplomat'
5
5
 
6
+ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], host: ENV['CONSUL_HOST'], port: ENV['CONSUL_PORT'])
7
+
8
+
6
9
  @opts = {
7
- url: 'http://localhost:8500',
8
10
  timeout: 10,
9
11
  ttl: 30 * 60
10
12
  }
@@ -12,10 +14,16 @@ require 'diplomat'
12
14
  parser = OptionParser.new do |o|
13
15
  o.banner = 'Usage: agglock [options]'
14
16
 
15
- o.on("--consul url=#{@opts[:url]}", 'Set up a custom Consul URL') do |url|
16
- Diplomat.configure do |config|
17
- config.url = url.strip
18
- end
17
+ o.on("--consul=#{consul_addr}", 'Set a fully qualified Consul URL. Take precendance') do |addr|
18
+ @opts[:consul_addr] = Aggkit::Consul.consul_addr(addr.to_s.strip)
19
+ end
20
+
21
+ o.on("--consul-host=#{consul_addr.host}", 'Set consul host. Ignored when consul specified') do |host|
22
+ @opts[:consul_host] = host.to_s.strip
23
+ end
24
+
25
+ o.on("--consul-port=#{consul_addr.port}", 'Set consul port. Ignored when consul specified') do |port|
26
+ @opts[:consul_port] = port.to_s.strip
19
27
  end
20
28
 
21
29
  o.on('--lock resource', 'resource name to lock with Consul') do |resource|
@@ -36,6 +44,22 @@ parser = OptionParser.new do |o|
36
44
  end
37
45
  parser.parse!
38
46
 
47
+ consul_addr = if !@opts[:consul_addr].to_s.empty?
48
+ Aggkit::Consul.build_consul_addr(addr: @opts[:consul_addr].to_s, host: nil, port: nil).to_s
49
+ elsif !@opts[:consul_host].to_s.empty? || !@opts[:consul_port].to_s.empty?
50
+ Aggkit::Consul.build_consul_addr(addr: nil, host: @opts[:consul_host], port: opts[:consul_port]).to_s
51
+ else
52
+ consul_addr
53
+ end
54
+
55
+ @opts[:consul] = consul_addr.to_s
56
+ ENV['CONSUL_HTTP_ADDR'] = consul_addr.to_s
57
+ ENV['CONSUL_HOST'] = consul_addr.host.to_s
58
+ ENV['CONSUL_PORT'] = consul_addr.port.to_s
59
+
60
+ Diplomat.configure do |config|
61
+ config.url = @opts[:consul]
62
+ end
39
63
 
40
64
  def lock(session, locker, timeout)
41
65
  Timeout.timeout(timeout) do
@@ -46,7 +70,7 @@ rescue Timeout::Error => e
46
70
  end
47
71
 
48
72
 
49
- if resource = @opts[:lock]
73
+ if (resource = @opts[:lock])
50
74
  locker = {
51
75
  Name: "#{resource}_locker_#{rand(999_999)}",
52
76
  Behavior: 'delete',
data/bin/aggstart CHANGED
@@ -6,13 +6,10 @@ UTIL = File.basename(__FILE__)
6
6
 
7
7
  include Aggkit::Runner
8
8
 
9
- if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
10
- ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
11
- end
9
+ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], host: ENV['CONSUL_HOST'], port: ENV['CONSUL_PORT'])
12
10
 
13
11
  @opts = {
14
12
  service: ENV['AGGREDATOR_SERVICE'],
15
- consul: ENV['CONSUL_HTTP_ADDR'],
16
13
  consulconf: [],
17
14
  depends: [],
18
15
  watch: true
@@ -33,14 +30,16 @@ parser = Aggkit::OptionParser.new do |o|
33
30
  @opts[:service] = service.to_s
34
31
  end
35
32
 
36
- o.on("--consul=#{@opts[:consul]}", 'Set consul http address. CONSUL_HTTP_ADDR env can be used instead') do |consul|
37
- ENV['CONSUL_HTTP_ADDR'] = if consul.to_s['http']
38
- consul.to_s
39
- else
40
- "http://#{consul}:8500"
41
- end
33
+ o.on("--consul=#{consul_addr}", 'Set a fully qualified Consul URL. Take precendance') do |addr|
34
+ @opts[:consul_addr] = Aggkit::Consul.consul_addr(addr.to_s.strip)
35
+ end
42
36
 
43
- @opts[:consul] = ENV['CONSUL_HTTP_ADDR']
37
+ o.on("--consul-host=#{consul_addr.host}", 'Set consul host. Ignored when consul specified') do |host|
38
+ @opts[:consul_host] = host.to_s.strip
39
+ end
40
+
41
+ o.on("--consul-port=#{consul_addr.port}", 'Set consul port. Ignored when consul specified') do |port|
42
+ @opts[:consul_port] = port.to_s.strip
44
43
  end
45
44
 
46
45
  o.on('--consulconf=consul,consul/smev3...', 'Set list of folders with consul configs. Special: none - disable local consul') do |list|
@@ -61,6 +60,18 @@ parser = Aggkit::OptionParser.new do |o|
61
60
  end
62
61
  parser.parse!
63
62
 
63
+ consul_addr = if !@opts[:consul_addr].to_s.empty?
64
+ Aggkit::Consul.build_consul_addr(addr: @opts[:consul_addr].to_s, host: nil, port: nil).to_s
65
+ elsif !@opts[:consul_host].to_s.empty? || !@opts[:consul_port].to_s.empty?
66
+ Aggkit::Consul.build_consul_addr(addr: nil, host: @opts[:consul_host], port: opts[:consul_port]).to_s
67
+ else
68
+ consul_addr
69
+ end
70
+
71
+ @opts[:consul] = consul_addr.to_s
72
+ ENV['CONSUL_HTTP_ADDR'] = consul_addr.to_s
73
+ ENV['CONSUL_HOST'] = consul_addr.host.to_s
74
+ ENV['CONSUL_PORT'] = consul_addr.port.to_s
64
75
 
65
76
  die 'service name must be provided' if @opts[:service].to_s.empty?
66
77
 
data/bin/aggwait CHANGED
@@ -18,7 +18,7 @@ INTERVAL = 3
18
18
  UTIL = File.basename(__FILE__)
19
19
 
20
20
  if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
21
- ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
21
+ ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:#{ENV['CONSUL_PORT'] || '8500'}"
22
22
  end
23
23
 
24
24
  @opts[:exec] = (begin
@@ -96,8 +96,12 @@ OptionParser.new do |o|
96
96
  @opts[:timeout] = timeout.to_i
97
97
  end
98
98
 
99
- o.on('-i', '--interval secs=2', 'Interval between attempts') do |interval|
100
- @opts[:interval] = interval.to_i
99
+ o.on('-e', '--timeout secs=15', 'Total timeout') do |timeout|
100
+ @opts[:timeout] = timeout.to_i
101
+ end
102
+
103
+ o.on('-i', '--error=msg', 'error message on failure') do |error|
104
+ @opts[:error] = error.to_s
101
105
  end
102
106
 
103
107
  o.on('-q', '--quiet', 'Do not output any status messages') do
@@ -152,7 +156,7 @@ def complete!(success)
152
156
  end
153
157
  end
154
158
 
155
- STDERR.puts 'Operation timed out'
159
+ STDERR.puts "Operation timed out. #{@opts[:error]}".strip
156
160
  exit 1
157
161
  end
158
162
 
data/bin/aggwrap CHANGED
@@ -62,14 +62,11 @@ DEFAULT_RELOAD_INTERVAL = 60 # seconds
62
62
 
63
63
  include Aggkit::Runner
64
64
 
65
- if ENV['CONSUL_HTTP_ADDR'].to_s.empty?
66
- ENV['CONSUL_HTTP_ADDR'] = "http://#{ENV['CONSUL_HOST'] || 'localhost'}:8500"
67
- end
65
+ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], host: ENV['CONSUL_HOST'], port: ENV['CONSUL_PORT'])
68
66
 
69
67
  @opts = {
70
68
  service: ENV['AGGREDATOR_SERVICE'],
71
69
  id: "#{Time.now.utc.strftime('%FT%T%z')}_#{SecureRandom.hex(2)}",
72
- consul: ENV['CONSUL_HTTP_ADDR'],
73
70
  reload_interval: DEFAULT_RELOAD_INTERVAL
74
71
  }
75
72
 
@@ -91,14 +88,16 @@ parser = Aggkit::OptionParser.new do |o|
91
88
  @opts[:id] = id.to_s
92
89
  end
93
90
 
94
- o.on("--consul=#{@opts[:consul]}", 'Set consul host. CONSUL_HOST env used when missed') do |consul|
95
- ENV['CONSUL_HTTP_ADDR'] = if consul.to_s['http']
96
- consul.to_s
97
- else
98
- "http://#{consul}:8500"
99
- end
91
+ o.on("--consul=#{consul_addr}", 'Set a fully qualified Consul URL. Take precendance') do |addr|
92
+ @opts[:consul_addr] = Aggkit::Consul.consul_addr(addr.to_s.strip)
93
+ end
94
+
95
+ o.on("--consul-host=#{consul_addr.host}", 'Set consul host. Ignored when consul specified') do |host|
96
+ @opts[:consul_host] = host.to_s.strip
97
+ end
100
98
 
101
- @opts[:consul] = ENV['CONSUL_HTTP_ADDR']
99
+ o.on("--consul-port=#{consul_addr.port}", 'Set consul port. Ignored when consul specified') do |port|
100
+ @opts[:consul_port] = port.to_s.strip
102
101
  end
103
102
 
104
103
  o.on('--http <PORT>', 'Create TTL consul check and pass http result to it') do |port|
@@ -124,6 +123,19 @@ parser = Aggkit::OptionParser.new do |o|
124
123
  end
125
124
  parser.parse!
126
125
 
126
+ consul_addr = if !@opts[:consul_addr].to_s.empty?
127
+ Aggkit::Consul.build_consul_addr(addr: @opts[:consul_addr].to_s, host: nil, port: nil).to_s
128
+ elsif !@opts[:consul_host].to_s.empty? || !@opts[:consul_port].to_s.empty?
129
+ Aggkit::Consul.build_consul_addr(addr: nil, host: @opts[:consul_host], port: opts[:consul_port]).to_s
130
+ else
131
+ consul_addr
132
+ end
133
+
134
+ @opts[:consul] = consul_addr.to_s
135
+ ENV['CONSUL_HTTP_ADDR'] = consul_addr.to_s
136
+ ENV['CONSUL_HOST'] = consul_addr.host.to_s
137
+ ENV['CONSUL_PORT'] = consul_addr.port.to_s
138
+
127
139
  die 'service name must be provided' if @opts[:service].to_s.empty?
128
140
 
129
141
  die 'script must be provided' if @opts[:exec].empty?
data/lib/aggkit/ci.rb CHANGED
@@ -213,7 +213,7 @@ module Aggkit
213
213
 
214
214
  unless config_file.empty?
215
215
  execute("docker exec -i #{consul} aggwait -t 20 --consul")
216
- execute("docker exec -i #{consul} aggconsul --init --override --config - < #{config_file}")
216
+ execute("docker exec -i #{consul} aggconsul --init --config - < #{config_file}")
217
217
  end
218
218
 
219
219
  execute('docker-compose up -t 30 -d')
@@ -233,7 +233,7 @@ module Aggkit
233
233
 
234
234
  unless config_file.empty?
235
235
  execute("docker exec -i #{consul} aggwait -t 20 --consul")
236
- execute("docker exec -i #{consul} aggconsul --init --override --config - < #{config_file}")
236
+ execute("docker exec -i #{consul} aggconsul --init --config - < #{config_file}")
237
237
  end
238
238
 
239
239
  # echo " * Consul ready"
data/lib/aggkit/consul.rb CHANGED
@@ -14,7 +14,19 @@ module Aggkit
14
14
  envs
15
15
  end
16
16
 
17
- def consul_addr addr_or_host
17
+ def build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], host: ENV['CONSUL_HOST'], port: ENV['CONSUL_PORT'])
18
+ return URI('http://localhost:8500') if addr.to_s.empty? && host.to_s.empty? && port.to_s.empty?
19
+
20
+ return URI(addr) unless addr.to_s.empty?
21
+
22
+ uri = URI(host)
23
+ uri = URI("http://#{host}") if uri.scheme.to_s.empty?
24
+ uri.port = port.to_i unless port.to_s.empty?
25
+
26
+ uri
27
+ end
28
+
29
+ def consul_addr(addr_or_host)
18
30
  if addr_or_host['http']
19
31
  addr_or_host
20
32
  else
@@ -28,12 +40,12 @@ module Aggkit
28
40
  load_envs(envs)
29
41
  end
30
42
 
31
- def wait_for_consul consul
43
+ def wait_for_consul(consul)
32
44
  consul_http = consul_addr(consul)
33
45
  Aggkit::Exec.execute!("aggwait -t 30 -i 5 --consul-addr=#{consul_http} --consul", 'Timeout for consul service')
34
46
  end
35
47
 
36
- def wait_for_service consul, service
48
+ def wait_for_service(consul, service)
37
49
  consul_http = consul_addr(consul)
38
50
  Aggkit::Exec.execute!("aggwait -t 60 -i 5 --consul-addr=#{consul_http} --consul-service #{service}", "Timeout for #{service} service")
39
51
  end
@@ -1,6 +1,6 @@
1
1
  module Aggkit
2
2
 
3
- VERSION = '0.4.5'.freeze
3
+ VERSION = '0.4.6'.freeze
4
4
 
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5.12925
4
+ version: 0.4.6.12955
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan