settingslogic icon indicating copy to clipboard operation
settingslogic copied to clipboard

sourcing additional files

Open brewster1134 opened this issue 14 years ago • 5 comments

im wondering how i can source an additional file and override values. what i am trying to do is have a settings.yml file.... and an additional user_settings.yml file. user_settings.yml will be omitted form version control and unique to each developer.

an example of what i would like to do is...

settings.yml defaults: &defaults interceptor_email: [email protected]

user_settings.yml # for userfoo defaults: interceptor_email: [email protected]

user_settings.yml # for userbar defaults: interceptor_email: [email protected]

say my class is Settings, calling on Settings.interceptor_email for the developer userfoo would return [email protected], and for userxyz, it would return [email protected] since he doesnt have a local user_settings.yml file.

maybe i am going about this the wrong way?

brewster1134 avatar Mar 31 '11 00:03 brewster1134

I would like to see something like this, as well. Is any work being done on it, or shall I take a stab?

greghaygood avatar Jul 13 '11 20:07 greghaygood

i had hoped to have a go at it, but never got around to it.

brewster1134 avatar Jul 13 '11 21:07 brewster1134

OK, maybe I'll give it a go this weekend.

On Wed, Jul 13, 2011 at 5:02 PM, brewster1134 < [email protected]>wrote:

i had hoped to have a go at it, but never got around to it.

Reply to this email directly or view it on GitHub: https://github.com/binarylogic/settingslogic/issues/17#issuecomment-1566057

greghaygood avatar Jul 13 '11 21:07 greghaygood

I added support to my fork this morning, and it seems to work well. Give it a shot, and if it's all good, I'll request a pull. Thanks!

https://github.com/greghaygood/settingslogic

greghaygood avatar Jul 16 '11 13:07 greghaygood

sorry just got around to checking out your fork. works great! But 1 thing...

I think the hashes need to be recursively merged. otherwise if a deeply nested key/value is missing from the 2nd hash, when its merged, the new hash will be missing that key/value as well instead of falling back on the key/value from the 1st hash. thoughts?

brewster1134 avatar Aug 11 '11 00:08 brewster1134