secret_env 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/secret_env/version.rb +1 -1
- data/lib/secret_env.rb +15 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1e1505edb2746b3c514bcfc4d63a55932bac752
|
4
|
+
data.tar.gz: 8caaa36d3a22b33d9d7765298239da62df506724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7875732f6642c3da35395258b837ff955368002094eefce272ce3acd06b945bb47689ec661604e4962aa4551333dd8f68406e17eb833f551ee9ebab81d43fad
|
7
|
+
data.tar.gz: 7b99d06bea62e93ba190d134c0fedfd86ffebdf9c0930dc0b683e1090c4b2f7d17e1c4e27f8373ec979272ccef38d60198d5cd36cf562e81f68685da813fe988
|
data/lib/secret_env/version.rb
CHANGED
data/lib/secret_env.rb
CHANGED
@@ -37,20 +37,24 @@ module SecretEnv
|
|
37
37
|
scanner = StringScanner.new(@raw_value)
|
38
38
|
parts = []
|
39
39
|
while part = scanner.scan_until(/#\{(.*?)\}/)
|
40
|
-
|
40
|
+
secret_keys = scanner.matched[2..-2] # Extract "secret" from "\#{secret}"
|
41
41
|
|
42
|
+
secret = nil
|
43
|
+
secret_keys.split("||").map(&:strip).each do |secret_key|
|
44
|
+
secret = case
|
45
|
+
when ENV.has_key?(secret_key)
|
46
|
+
ENV[secret_key]
|
47
|
+
when @dependency.has_key?(secret_key)
|
48
|
+
# FIXME this code may cause infinite loop
|
49
|
+
@dependency[secret_key].value
|
50
|
+
else
|
51
|
+
@storage.retrieve(secret_key)
|
52
|
+
end
|
42
53
|
|
43
|
-
|
44
|
-
|
45
|
-
ENV[secret_key]
|
46
|
-
when @dependency.has_key?(secret_key)
|
47
|
-
# FIXME this code may cause infinite loop
|
48
|
-
@dependency[secret_key].value
|
49
|
-
else
|
50
|
-
@storage.retrieve(secret_key)
|
51
|
-
end
|
54
|
+
break if secret
|
55
|
+
end
|
52
56
|
|
53
|
-
raise SecretEnv::KeyNotFound,
|
57
|
+
raise SecretEnv::KeyNotFound, secret_keys unless secret
|
54
58
|
parts << part.gsub(scanner.matched, secret)
|
55
59
|
end
|
56
60
|
parts << scanner.rest
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secret_env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- adorechic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.5.1
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: SecretEnv retrieves secrets and export to ENV
|