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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f671936a687a78a5158ba433948759423662cc5
4
- data.tar.gz: 8395757567a109bc9de779e8e6f2236c08596d90
3
+ metadata.gz: 553e93e239b69f83d7fe5fb0cda5153fcc0f8ce7
4
+ data.tar.gz: 3d9007fe77914b4e7d88a1665cce0fb4291a9c32
5
5
  SHA512:
6
- metadata.gz: ed8dccddba2ab1d5b06d193ef24127f54ce37272d4da9201278a6a4f8ec1938e8883cc37b50677471cae03fae35bac41a2c14d9352e6ac59a5073b252c4f2610
7
- data.tar.gz: 501c4461a230a2a82a362bc54c15c83cebaaf4fbd7dba1802f428fe408901147ede15dc4fb579a0df5f3308fac87a62938122ba5c68e1db7223f189ef9f19ca2
6
+ metadata.gz: ea0d5e559bf833679d176bc5a3930c1a49f1e3d2e14233ec6e7f33ae2fed039be9a725138824c7e03930bfbc2360f6ccb66bc4c51f61c3b8fa03a7d4de4e2723
7
+ data.tar.gz: 6d9d274ddb7871100155501bc811bac435109fb2cd918aa7962f52e55c7270c206cad097dd61c4c4ee80ae73181f7e22177c2e11878896db9a8f9d87d544c97b
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chamber
4
+ module Errors
5
+ class EnvironmentConversion < ArgumentError
6
+ end
7
+ end
8
+ end
@@ -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(ENV[environment_key], 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chamber
4
- VERSION = '2.12.2'
4
+ VERSION = '2.12.3'
5
5
  end
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.2
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-24 00:00:00.000000000 Z
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