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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +18 -2
- data/lib/config/options.rb +5 -2
- data/lib/config/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2212e68e8bb8e15f821b9420db10ec3111edcaa43bffe5450ae850d5228b3107
|
4
|
+
data.tar.gz: de9c513f5a6450a95e113071adf79c3d3b3e2f3485a018e14ab72241a2f419e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae72b6c10869bbca57d7c476e5ba7b48637b6c94c083176b2c7321710bd4daebe5f41c03d3daf69157dd3f599f63f11d74e19141e98716ae3ef20c8c33469ba3
|
7
|
+
data.tar.gz: 07e79c9a667587218a3370c03e912c113795fa00a9f50350065834c91b9d858e03ee1447da078e6ec5af19c32faa5317f3a94b071478d4b96397317504891ac7
|
data/CHANGELOG.md
CHANGED
@@ -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
|
194
|
-
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.
|
data/lib/config/options.rb
CHANGED
@@ -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
|
data/lib/config/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deep_merge
|