config 2.2.2 → 2.2.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
  SHA256:
3
- metadata.gz: fa6adc2bd8ce8b4bfbd732f11005ae7657ef8f5eb8c08b9e08d480408d344433
4
- data.tar.gz: 48d8c6f90457636a2e1732df83cda5dfa2d2d4f5f8286bf7ceb8683f09831e4e
3
+ metadata.gz: 2212e68e8bb8e15f821b9420db10ec3111edcaa43bffe5450ae850d5228b3107
4
+ data.tar.gz: de9c513f5a6450a95e113071adf79c3d3b3e2f3485a018e14ab72241a2f419e0
5
5
  SHA512:
6
- metadata.gz: 32228943bbf540ef716f788fd2cde8c51161cf7a92c3d17f36a109aadf895fde2240187f04e7be17a61488602521ee646c74bdf60657c21ad382b757fd22c203
7
- data.tar.gz: e148e52b0f43442c9e8a36e406622d538bcdf9e2faa7eb256376d60bcf2fd8c7c0bf5890a13077a47a0d8415d908ec63567e622f948f93086181f02c653d68b8
6
+ metadata.gz: ae72b6c10869bbca57d7c476e5ba7b48637b6c94c083176b2c7321710bd4daebe5f41c03d3daf69157dd3f599f63f11d74e19141e98716ae3ef20c8c33469ba3
7
+ data.tar.gz: 07e79c9a667587218a3370c03e912c113795fa00a9f50350065834c91b9d858e03ee1447da078e6ec5af19c32faa5317f3a94b071478d4b96397317504891ac7
@@ -4,6 +4,16 @@
4
4
 
5
5
  ...
6
6
 
7
+ ## 2.2.3
8
+
9
+ ### Bug fixes
10
+
11
+ * Revert added alias to_h for to_hash ([#277](https://github.com/railsconfig/config/issues/277))
12
+
13
+ ### Changes
14
+
15
+ * Raise explicit error on environment variable conflicts ([#293](https://github.com/railsconfig/config/issues/293))
16
+
7
17
  ## 2.2.2
8
18
 
9
19
  ### Bug fixes
data/README.md CHANGED
@@ -190,8 +190,9 @@ Settings.add_source!("#{Rails.root}/config/settings/local.yml")
190
190
  Settings.reload!
191
191
  ```
192
192
 
193
- > Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
194
- settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
193
+ > Note: this is an example usage, it is easier to just use the default local
194
+ > files `settings.local.yml`, `settings/#{Rails.env}.local.yml` and
195
+ > `environments/#{Rails.env}.local.yml` for your developer specific settings.
195
196
 
196
197
  You also have the option to add a raw hash as a source. One use case might be storing settings in the database or in environment variables that overwrite what is in the YML files.
197
198
 
@@ -419,6 +420,21 @@ ENV['Settings.section.server'] = 'google.com'
419
420
 
420
421
  It won't work with arrays, though.
421
422
 
423
+ It is considered an error to use environment variables to simutaneously assign a "flat" value and a multi-level value to a key.
424
+
425
+ ```ruby
426
+ # Raises an error when settings are loaded
427
+ ENV['BACKEND_DATABASE'] = 'development'
428
+ ENV['BACKEND_DATABASE_USER'] = 'postgres'
429
+ ```
430
+
431
+ Instead, specify keys of equal depth in the environment variable names:
432
+
433
+ ```ruby
434
+ ENV['BACKEND_DATABASE_NAME'] = 'development'
435
+ ENV['BACKEND_DATABASE_USER'] = 'postgres'
436
+ ```
437
+
422
438
  ### Working with Heroku
423
439
 
424
440
  Heroku uses ENV object to store sensitive settings. You cannot upload such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh. To use config with Heroku just set the `use_env` var to `true` as mentioned above.
@@ -59,6 +59,11 @@ module Config
59
59
  h[key] ||= {}
60
60
  }
61
61
 
62
+ unless leaf.is_a?(Hash)
63
+ conflicting_key = (prefix + keys[0...-1]).join(separator)
64
+ raise "Environment variable #{variable} conflicts with variable #{conflicting_key}"
65
+ end
66
+
62
67
  leaf[keys.last] = Config.env_parse_values ? __value(value) : value
63
68
  end
64
69
 
@@ -118,8 +123,6 @@ module Config
118
123
  result
119
124
  end
120
125
 
121
- alias :to_h :to_hash
122
-
123
126
  def each(*args, &block)
124
127
  marshal_dump.each(*args, &block)
125
128
  end
@@ -1,3 +1,3 @@
1
1
  module Config
2
- VERSION = '2.2.2'.freeze
2
+ VERSION = '2.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Kuczynski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-12-08 00:00:00.000000000 Z
13
+ date: 2020-12-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: deep_merge