On Fri, Dec 9, 2011 at 12:50 PM, Patrick Crowley <[email protected]>wrote:
> > It pulls in config/initializers/* automatically, not config/*
>
> Even so, just comment everything out in the example files, so it can't
> execute.
>
One approach I've taken with secrets in initializers is to have code in the
initializer load the secret from a different file. Depending on how you
deploy, you can then 'search' for the file, and load it...
For Capistrano based deployments, something like this...
if File.exist?("#{shared_dir_in_production}/my_config.yml"
# Load the file from its location on production/staging servers
conf = YAML::load_file(...)
elsif File.exist?("~/.my_config.yml")
# This is for developers, if appropriate
conf = YAML::load_file(...)
else
# fail or continue, depending on your needs
end
If you are on something like heroku, this would look different. (I haven't
done anything like this with Heroku, so I can't offer much.)
The idea is that the initialization gets committed to source control, but
the data that goes into that initialization is managed a bit differently.
This has benefits. One important one being your test environment can choose
to live without real secrets, which means your continuous integration
server doesn't need to deal with this.
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby