chamber 2.12.2 → 2.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/chamber/errors/environment_conversion.rb +8 -0
- data/lib/chamber/filters/environment_filter.rb +17 -4
- data/lib/chamber/version.rb +1 -1
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553e93e239b69f83d7fe5fb0cda5153fcc0f8ce7
|
4
|
+
data.tar.gz: 3d9007fe77914b4e7d88a1665cce0fb4291a9c32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea0d5e559bf833679d176bc5a3930c1a49f1e3d2e14233ec6e7f33ae2fed039be9a725138824c7e03930bfbc2360f6ccb66bc4c51f61c3b8fa03a7d4de4e2723
|
7
|
+
data.tar.gz: 6d9d274ddb7871100155501bc811bac435109fb2cd918aa7962f52e55c7270c206cad097dd61c4c4ee80ae73181f7e22177c2e11878896db9a8f9d87d544c97b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'hashie/mash'
|
5
5
|
|
6
|
+
require 'chamber/errors/environment_conversion'
|
7
|
+
|
6
8
|
module Chamber
|
7
9
|
module Filters
|
8
10
|
class EnvironmentFilter
|
@@ -108,7 +110,9 @@ class EnvironmentFilter
|
|
108
110
|
{ key => execute(value, environment_keys) }
|
109
111
|
end,
|
110
112
|
lambda do |key, value, environment_key|
|
111
|
-
{ key => convert_environment_value(
|
113
|
+
{ key => convert_environment_value(environment_key,
|
114
|
+
ENV[environment_key],
|
115
|
+
value) }
|
112
116
|
end,
|
113
117
|
)
|
114
118
|
end
|
@@ -134,8 +138,8 @@ class EnvironmentFilter
|
|
134
138
|
environment_hash
|
135
139
|
end
|
136
140
|
|
137
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
138
|
-
def convert_environment_value(environment_value, settings_value)
|
141
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
142
|
+
def convert_environment_value(environment_key, environment_value, settings_value)
|
139
143
|
return settings_value unless environment_value
|
140
144
|
return if %w{___nil___ ___null___}.include?(environment_value)
|
141
145
|
|
@@ -164,8 +168,17 @@ class EnvironmentFilter
|
|
164
168
|
else
|
165
169
|
environment_value
|
166
170
|
end
|
171
|
+
rescue ArgumentError
|
172
|
+
raise Chamber::Errors::EnvironmentConversion, <<~HEREDOC
|
173
|
+
We attempted to convert '#{environment_key}' from '#{environment_value}' to a '#{settings_value.class.name}'.
|
174
|
+
|
175
|
+
Unfortunately, this did not go as planned. Please either verify that your value is convertable
|
176
|
+
or change the original YAML value to be something more generic (like a String).
|
177
|
+
|
178
|
+
For more information, see https://github.com/thekompanee/chamber/wiki/Environment-Variable-Coercions
|
179
|
+
HEREDOC
|
167
180
|
end
|
168
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
181
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
169
182
|
end
|
170
183
|
end
|
171
184
|
end
|
data/lib/chamber/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chamber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekompanee
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
etYUO0DlNY/qYfSfExrgt0W5dZeT09V++WPlYauHw/EZtAB0AsJwVdtIscq0HSvX
|
35
35
|
yH9AFp3KIe0v70EXzao/94n+XoDULrHEhqGMo34iS+37ZA==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2018-01-
|
37
|
+
date: 2018-01-27 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: thor
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/chamber/encryption_methods/public_key.rb
|
182
182
|
- lib/chamber/encryption_methods/ssl.rb
|
183
183
|
- lib/chamber/errors/decryption_failure.rb
|
184
|
+
- lib/chamber/errors/environment_conversion.rb
|
184
185
|
- lib/chamber/file.rb
|
185
186
|
- lib/chamber/file_set.rb
|
186
187
|
- lib/chamber/files/signature.rb
|
metadata.gz.sig
CHANGED
Binary file
|