-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option overwriting doesn't work (for me, at least) #12
Comments
I am seeing the same behavior, but for standard filenames. For example: I have a list key set in It appears this only occurs with lists (the lists are merged instead of replaced). I suspect this is the same issue, but haven't taken a look at the code yet... |
Same for me, I have two files production.yml assets:
hosts:
- somehost1
- somehost2
id: 1234 preview.yml assets:
hosts:
- somehost3 Settings.add_source! "/path/to/production.yml"
Settings.add_source! "/path/to/preview.yml"
Settings.reload results in Settings.assets.hosts == ["somehost1", "somehost2", "somehost3"]
Settings.assets.id == nil So mine also unsets the id field |
I ran into this same issue on the current version today. I can see that arrays are intentionally additive (https://github.com/railsjedi/rails_config/blob/master/spec/rails_config_spec.rb#L111). The problem is that this behavior is inconsistent with the normal hash behavior as well as the documentation. It also means that we have to create a special case in our default config file so our production.yml config file can work correctly. I'd be willing to cook up a change and a pull request if the authors agreed. |
@bgadoury It'd be great if you could provide us a pull request! Thanks! :) |
Hey guys - I bumped into the same problem today, and found this 5 year old ticket with a 1 year old open PR.... is this fix happening? Or should we just consider arrays as non overridables for now? |
Hey Danny, I had the same problem and made a fix around the same time this was fixed. But after that the deepmerge was extracted in a separate gem. And as the deepmerge gem isn't updated in a long time. I guess it's not in there. That's why I still have a fork where I implemented this feature. You can find it here: https://github.com/vinceve/rails_config I know this is not really a solution for the problem. But it's a temporary solution. |
Thenks @vinceve - good to know. I am relying heavily on this config gem and its overrides. I hope to hear from one of the contributors about this ticket, to at least know whats the official policy in the canonical repository, and if there is a plan to change the current additive behavior. |
This has been fixed in #137 |
Hiya,
I'm using an optional YML file with additional options as well as changes to the existing ones, which is loaded if it exists (doing so via
Settings.add_source!("#{Rails.root}/config/lpl.yml")
in my app's initializer). The problem is that I have the following defined in settings.yml:while my own file has
I was expecting the result to be that
Settings.lpl.language_options
would hold["de"]
, yet it still holds["de", "en"]
. Do I need to do anything besideswhen loading the additional settings in my initlializer? Or should I be unloading all settings and include all the settings in
lpl.yml
, not just the ones that would add to/overwrite stuff fromconfig.yml
? And if so—how?Thanks! :)
The text was updated successfully, but these errors were encountered: