Skip to content

Commit

Permalink
Set default overwrite_arrays option to true. Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Kuczynski committed Sep 14, 2016
1 parent 3c7b18f commit 80b2e7b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

## ...
## 1.3.0

* **WARNING:** Overwrite arrays found in previously loaded settings file ([#137](https://github.com/railsconfig/config/pull/137) thanks to [@Fryguy](https://github.com/Fryguy) and [@dtaniwaki](https://github.com/dtaniwaki)) - this is a change breaking previous behaviour. If you want to keep Config to work as before, which is merging arrays found in following loaded settings file, please add `config.overwrite_arrays = true` to your Config initializer

This comment has been minimized.

Copy link
@thinca

thinca Sep 23, 2016

Maybe this is config.overwrite_arrays = false, isn't it?

This comment has been minimized.

Copy link
@pkuczynski

pkuczynski Sep 23, 2016

Member

Of course! My bad. I will fix it straight away...

* Changed default ENV variables loading settings to downcase variable names and parse values
* Added parsing ENV variables values to Float type
* Change method definition order in Rails integration module to prevent undefined method `preload` error (based on [@YaroSpace](https://github.com/YaroSpace) suggestion in [#111](https://github.com/railsconfig/config/issues/111)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ located at `config/initializers/config.rb`.
### Merge customization

* `knockout_prefix` - ability to remove elements of the array set in earlier loaded settings file. Default: `nil`

* `overwrite_arrays` - ability to replace an entire array set in earlier loaded settings file. Default: `false`
* `overwrite_arrays` - overwrite arrays found in previously loaded settings file. Default: `true`

Check [Deep Merge](https://github.com/danielsdeleo/deep_merge) for more details.

Expand Down
2 changes: 1 addition & 1 deletion lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Config
# deep_merge options
mattr_accessor :knockout_prefix, :overwrite_arrays
@@knockout_prefix = nil
@@overwrite_arrays = false
@@overwrite_arrays = true

def self.setup
yield self if @@_ran_once == false
Expand Down
4 changes: 4 additions & 0 deletions lib/generators/config/templates/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#
# config.knockout_prefix = nil

# Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
#
# config.overwrite_arrays = true

# Load environment variables from the `ENV` object and override any settings defined in files.
#
# config.use_env = false
Expand Down

0 comments on commit 80b2e7b

Please sign in to comment.