aggkit 0.3.5 → 0.3.6

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/aggstart +15 -6
  3. data/lib/aggkit/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37fe2901158e5309db8e3eb0e3376e7b606c0c3c2c88c69d9985788f1168b5de
4
- data.tar.gz: 771afcf919ab0c727dc0ce928894d6ac2f2df54eb583a7e0aef815f18f726b9e
3
+ metadata.gz: c156f847b57ffb06d37850c4119c7503da301329100855a826db70827aad4d48
4
+ data.tar.gz: 91bc2e8238ae3075be4cf2dd095ac2369a7cf0d917903c149fda4f38c4ed8074
5
5
  SHA512:
6
- metadata.gz: 438119fb45e3ac6f8b0581b6440157966e29e3a28fcae73079c426cc97bd138fd4962fe85c4cca5f579323a377a5b69e59e9ab57220e9edb3c6a60202c9178b8
7
- data.tar.gz: fbf311f0ff57bb254f563ea6ef89dfde4ef8a6aa7bc12e1a7ebe9f46f06683f48fab3d9679b00cdd9acf6e39562c615486047142fdea82eac9517eb351857c3b
6
+ metadata.gz: d875af24df50d76c408d15bf827f3173fb506d2e4fb1e6d932f8d220c1fda159b2a70e087a38809ce1febb57a5582205bd46879596d643b4c28456fc7bf7be84
7
+ data.tar.gz: 8970df7a2b695a6b8eb45e6a672e69d6e45e498ae15c83bf3a6b8e8eaafc78c756af6014acf0d0689d5f13e2ca64ebbcc51841fb79448de6e0ce46ae2c858012
data/bin/aggstart CHANGED
@@ -4,9 +4,13 @@ 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
10
+
7
11
  @opts = {
8
12
  service: ENV['AGGREDATOR_SERVICE'],
9
- consul: ENV['CONSUL_HTTP_ADDR'] || ENV['CONSUL_HOST'] || 'localhost',
13
+ consul: ENV['CONSUL_HTTP_ADDR'],
10
14
  consulconf: [],
11
15
  depends: []
12
16
  }
@@ -26,8 +30,14 @@ parser = Aggkit::OptionParser.new do |o|
26
30
  @opts[:service] = service.to_s
27
31
  end
28
32
 
29
- o.on("--consul=#{@opts[:consul]}", 'Set consul host. CONSUL_HOST env can be used instead') do |consul|
30
- @opts[:consul] = consul.to_s
33
+ o.on("--consul=#{@opts[:consul]}", 'Set consul http address. CONSUL_HTTP_ADDR env can be used instead') do |consul|
34
+ if consul.to_s['http']
35
+ ENV['CONSUL_HTTP_ADDR'] = consul.to_s
36
+ else
37
+ ENV['CONSUL_HTTP_ADDR'] = "http://#{consul.to_s}:8500"
38
+ end
39
+
40
+ @opts[:consul] = ENV['CONSUL_HTTP_ADDR']
31
41
  end
32
42
 
33
43
  o.on('--consulconf=consul,consul/smev3...', 'Set list of folders with consul configs. Special: none - disable local consul') do |list|
@@ -54,7 +64,6 @@ die 'exec script must be provided' if @opts[:exec].empty?
54
64
  @opts[:node_name] = "#{@opts[:service]}_#{`hostname`.strip}".strip
55
65
 
56
66
  ENV['AGGREDATOR_SERVICE'] = @opts[:service]
57
- ENV['CONSUL_HOST'] = @opts[:consul]
58
67
  ENV['NODE_NAME'] = @opts[:node_name]
59
68
 
60
69
  init_service @opts[:service], @opts
@@ -75,12 +84,12 @@ Aggkit::Watcher.new.exec do |watcher|
75
84
  end
76
85
 
77
86
 
78
- execute!("aggwait -t 20 --consul-addr=http://#{@opts[:consul]}:8500 --consul", 'Timeout for consul service')
87
+ execute!("aggwait -t 20 --consul-addr=#{@opts[:consul]} --consul", 'Timeout for consul service')
79
88
 
80
89
  load_envs_from_consul(@opts[:consul], @opts[:service])
81
90
 
82
91
  @opts[:depends].each do |service|
83
- execute!("aggwait -t 60 --consul-addr=http://#{@opts[:consul]}:8500 --consul-service #{service}", "Timeout for #{service} service")
92
+ execute!("aggwait -t 60 --consul-addr=#{@opts[:consul]} --consul-service #{service}", "Timeout for #{service} service")
84
93
  end
85
94
 
86
95
  sleep 2
@@ -1,6 +1,6 @@
1
1
  module Aggkit
2
2
 
3
- VERSION = '0.3.5'.freeze
3
+ VERSION = '0.3.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.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan