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
Hash as source #10
Comments
I see there aren't any tests that cover this use case, which seems to have been broken for a while. The problem is that source is used unconditionally as the section when the section is not explicitly provided. That doesn't suit the "Hash as source" use case, because the source() method doesn't allow the caller to provide a section name to pass through to initialize(). We could either use "Hash" as the section name when hash_or_file is a Hash, or we could extend the source() method to take an optional section name. That'll get a bit messy. Thoughts? |
Trying to load hash with the same success as @sheldonh class AppConfig < Settingslogic
[...]
def self.load_from_redis
r = Redis.new url: ENV['REDIS-URL']
cfg = JSON.parse r.get("cfg.#{ Rails.env }")
r.quit
return cfg
end
source( self.load_from_redis )
end
etc |
I run into this, I used this to make it work:
So basically I found 2 issues to be able to use the config from a hash source:
But yes not sure what is the best fix for the upstream class. |
I can't figure out how to use a Hash as source. I try this:
And I get this:
Does that code still work?
The text was updated successfully, but these errors were encountered: