config 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +4 -1
- data/lib/config.rb +2 -1
- data/lib/config/sources/yaml_source.rb +8 -2
- data/lib/config/version.rb +1 -1
- data/lib/generators/config/templates/config.rb +3 -0
- 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: ee641c05cf97c8e76b7076ba7b9c66e490999d307cf4be1b6c404f5cabfc38a5
|
4
|
+
data.tar.gz: 9c9b4f47ca0259234082bd4339df446370e0f8cda3be6e8dfb25aff347c2ac75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 374734550ff18a367d2932d10601dda32cfd29640b7ce7e647c00b11b5f3dbd85afbcb57d9e3dd369cbd5d9b1c44e66af4ed7b4c5bc438136ed9474d9797741f
|
7
|
+
data.tar.gz: '093ca60e0208e03bd6b4cf624084c2eeead073b531c702196d325aff5f9d48bfaf1da326d3725bb7d79702ff66a6332942e478a553e14b02dea54cc6a491619a'
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@
|
|
4
4
|
|
5
5
|
...
|
6
6
|
|
7
|
+
## 3.1.0
|
8
|
+
|
9
|
+
### New features
|
10
|
+
|
11
|
+
* Evaluating ERB in YAML files can now be disabled with `Config.evaluate_erb_in_yaml = false`. The default value for this option is `true` for backwards-compatibility. ([#303](https://github.com/rubyconfig/config/pull/303))
|
12
|
+
|
7
13
|
## 3.0.0
|
8
14
|
|
9
15
|
### BREAKING CHANGES
|
@@ -17,7 +23,7 @@
|
|
17
23
|
|
18
24
|
### Changes
|
19
25
|
|
20
|
-
* Add `Config::Sources::EnvSource` for loading settings from flat `Hash`es with `String` keys and `String` values ([#299](https://github.com/railsconfig/config/pull/299))
|
26
|
+
* Add `Config::Sources::EnvSource` for loading settings from flat `Hash`es with `String` keys and `String` values, such as from AWS SecretsManager ([#299](https://github.com/railsconfig/config/pull/299))
|
21
27
|
|
22
28
|
## 2.2.3
|
23
29
|
|
data/README.md
CHANGED
@@ -205,7 +205,9 @@ You may pass a hash to `prepend_source!` as well.
|
|
205
205
|
|
206
206
|
## Embedded Ruby (ERB)
|
207
207
|
|
208
|
-
Embedded Ruby is allowed in the configuration files.
|
208
|
+
Embedded Ruby is allowed in the YAML configuration files. ERB will be evaluated at load time by default, and when the `evaluate_erb_in_yaml` configuration is set to `true`.
|
209
|
+
|
210
|
+
Consider the two following config files.
|
209
211
|
|
210
212
|
* ```#{Rails.root}/config/settings.yml```
|
211
213
|
|
@@ -266,6 +268,7 @@ After installing `Config` in Rails, you will find automatically generated file t
|
|
266
268
|
### General
|
267
269
|
|
268
270
|
* `const_name` - name of the object holing you settings. Default: `'Settings'`
|
271
|
+
* `evaluate_erb_in_yaml` - evaluate ERB in YAML config files. Set to false if the config file contains ERB that should not be evaluated at load time. Default: `true`
|
269
272
|
|
270
273
|
### Merge customization
|
271
274
|
|
data/lib/config.rb
CHANGED
@@ -5,14 +5,20 @@ module Config
|
|
5
5
|
module Sources
|
6
6
|
class YAMLSource
|
7
7
|
attr_accessor :path
|
8
|
+
attr_reader :evaluate_erb
|
8
9
|
|
9
|
-
def initialize(path)
|
10
|
+
def initialize(path, evaluate_erb: Config.evaluate_erb_in_yaml)
|
10
11
|
@path = path.to_s
|
12
|
+
@evaluate_erb = !!evaluate_erb
|
11
13
|
end
|
12
14
|
|
13
15
|
# returns a config hash from the YML file
|
14
16
|
def load
|
15
|
-
|
17
|
+
if @path and File.exist?(@path)
|
18
|
+
file_contents = IO.read(@path)
|
19
|
+
file_contents = ERB.new(file_contents).result if evaluate_erb
|
20
|
+
result = YAML.load(file_contents)
|
21
|
+
end
|
16
22
|
|
17
23
|
result || {}
|
18
24
|
|
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: 3.
|
4
|
+
version: 3.1.0
|
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: 2021-
|
13
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deep_merge
|