aggkit 0.4.6.12981 → 0.4.6.13035

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
  SHA256:
3
- metadata.gz: 12ae9e1f75683bf395b350f1d3e236bcf379148b58f05c1a16489bd704a592c3
4
- data.tar.gz: '038b25ef20529fc2817799c9df0cc6aa2c39edd657ad69deef7bff241e8b3a72'
3
+ metadata.gz: fc41d1a529e9abaa8a424db2024abd58b6da1f417387abdd1faa4c91a5656fbd
4
+ data.tar.gz: 80ac8d7e82efad5d5bb93804acee4e37ec554faecd4720345b613a24b1cacb99
5
5
  SHA512:
6
- metadata.gz: 5ace4f576c16f5ed25b738fb64f57c398a3df252cfe8b6137ec69c345d817c6e814aaf13ac3c76d7a122685e50f91246a37e7567789b5a717dc1e45814c79920
7
- data.tar.gz: 131cffabaa956bb278006414a1668aa8345d31b4ba4197cbd2f335c85c772f58ec8def6520189fa80de730994bdceccaffbd8136c17c53b4e3ff98e09c78aa33
6
+ metadata.gz: 9b0b7d463c041872ffd60971f2af4e39295ffc688ba4a49b504e834237a02d9267f3f162878a31a1c9a4cfb58a294cc2768693c89f92da52efa46709db966b49
7
+ data.tar.gz: e2ed1577dabc96603df538ed92e8bb384418d202540530e8d558ed26efb6359d456edee1c35657eb7e67b571bac83bbd7bc06398c3973e0a65f2a733d06cbc92
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aggkit (0.4.6.12981)
4
+ aggkit (0.4.6.13035)
5
5
  diplomat
6
6
  dotenv
7
7
  json
data/bin/aggexec CHANGED
@@ -8,9 +8,10 @@ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], ho
8
8
 
9
9
 
10
10
  @opts = {
11
- depends: [],
12
- prefixes: [],
13
- templates: []
11
+ depends: [],
12
+ prefixes: [],
13
+ templates: [],
14
+ dereference:true
14
15
  }
15
16
 
16
17
  @opts[:exec] = (begin
@@ -47,6 +48,10 @@ parser = Aggkit::OptionParser.new do |o|
47
48
  @opts[:prefixes] << "services/env/#{service}".strip
48
49
  end
49
50
 
51
+ opts.on('--[no-]ref', 'dereference consul values in form of "consul://key/subkey"') do |v|
52
+ options[:dereference] = v
53
+ end
54
+
50
55
  o.on('--templates=<FOLDER>', 'Folder for recursive envsubst *.in templates. Multiple prefixes are merged from left to right.') do |folder|
51
56
  @opts[:templates] << folder.strip
52
57
  end
@@ -76,6 +81,10 @@ ENV['CONSUL_PORT'] = consul_addr.port.to_s
76
81
 
77
82
  Aggkit::Exec.die 'exec script must be provided' if @opts[:exec].empty? && !@opts[:noexec]
78
83
 
84
+ def load_envs_from_consul(prefix)
85
+ Aggkit::Consul.load_envs_from_consul(@opts[:consul], prefix, dereference: @opts[:dereference])
86
+ end
87
+
79
88
  if @opts[:depends].any? || @opts[:prefixes].any?
80
89
  # Wait for consul
81
90
  Aggkit::Consul.wait_for_consul(@opts[:consul])
@@ -84,7 +93,7 @@ if @opts[:depends].any? || @opts[:prefixes].any?
84
93
  @opts[:depends].each(&Aggkit::Consul.method(:wait_for_service).curry.call(@opts[:consul]))
85
94
 
86
95
  # Load env from consul
87
- @opts[:prefixes].each(&Aggkit::Consul.method(:load_envs_from_consul).curry.call(@opts[:consul]))
96
+ @opts[:prefixes].each(&load_envs_from_consul)
88
97
  end
89
98
 
90
99
  # Preprocess template files
data/lib/aggkit/consul.rb CHANGED
@@ -26,7 +26,6 @@ module Aggkit
26
26
  else
27
27
  uri.port = port.to_i
28
28
  end
29
-
30
29
 
31
30
  uri
32
31
  end
@@ -39,9 +38,10 @@ module Aggkit
39
38
  end
40
39
  end
41
40
 
42
- def load_envs_from_consul(consul, prefix)
41
+ def load_envs_from_consul(consul, prefix, dereference: true)
43
42
  consul_http = consul_addr(consul)
44
- envs = Aggkit::Exec.capture!("aggconsul --consul=#{consul_http} --env #{prefix} --pristine -d", "Can't load envs from #{prefix}")
43
+ dr = dereference ? '-d' : ''
44
+ envs = Aggkit::Exec.capture!("aggconsul --consul=#{consul_http} --env #{prefix} --pristine #{dr}", "Can't load envs from #{prefix}")
45
45
  load_envs(envs)
46
46
  end
47
47
 
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.6.12981
4
+ version: 0.4.6.13035
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-06-26 00:00:00.000000000 Z
12
+ date: 2019-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diplomat