For development, you'll want to use a configuration file that is ignored in version control. It could be YAML, JSON, ruby, bash... it's a trivial choice. You'll then use an initializer file to make sure these variables are loaded when the app boots. For production, you can copy the config file (it may even have different settings) into the right place as part of your deploy process; or if you're using heroku, you can set these from command line using heroku config:add YADA=yada
.
Here's a basic example with settings coming from a YAML file:
# config/settings.yml
development:
MANDRILL_USERNAME=secret_username
MANDRILL_PASSWORD=secret_password
ANOTHER_SECRET_SETTING=the_list_goes_on_and_on
production:
MANDRILL_USERNAME=different_username
MANDRILL_PASSWORD=another_password
ANOTHER_SECRET_SETTING=get_the_idea?
# .gitigore
# ...
config/settings.yml
# config/initializers/environment_settings.rb
environment_settings = YAML.load_file('./config/settings.yml')[Rails.env]
environment_settings.each do |key, value|
ENV[key] ||= value
end