settingslogic
settingslogic copied to clipboard
sourcing additional files
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?
I would like to see something like this, as well. Is any work being done on it, or shall I take a stab?
i had hoped to have a go at it, but never got around to it.
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
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
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?