In my config/deploy.rb I have some configuration variables stored in a YAML file.
What's the best way to load this in? Currently I have:
CONFIG = YAML.load(File.open('config/deploy/deploy.yml'))
# >> File.open('config/deploy/deploy.yml')
# => #<File:config/deploy/deploy.yml>
This doesn't load a full path though, so I could do:
CONFIG = YAML.load(File.open(Rails.root.join('config/deploy', 'deploy.yml')))
# >> File.open(Rails.root.join('config/deploy', 'deploy.yml'))
# => #<File:/Users/gareth/Code/repo/config/deploy/deploy.yml>
Is there a "standard" way of doing this? What do you guys do?
You can use https://github.com/binarylogic/settingslogic Settings Logic gem. It provides nice interface for interaction with application configs.
In Rails 4.2 (currently in beta) you'll be able to load yaml configs like this:
@vestimir Guess we can mention this is the guide.
I'll send a PR later today ;)
Fixed by #136 👍