I have a very simple Rails app that sends out a welcome email when the user signs up. I'm using my gmail account to send the message, and I have the password for my gmail account stored in the app, as shown below:
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
ENV.update YAML.load(File.read(File.expand_path('../application.yml', __FILE__)))
module TestMailApp
class Application < Rails::Application
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "my address",
:user_name => "my_gmail_name",
:password => ENV["MAIL_PASSWORD"],
:authentication => :plain,
:enable_starttls_auto => true
}
config.action_mailer.default_url_options = {
:host => "my address"
}
application.yml
MAIL_PASSWORD: "my_password"
I want to hide the password stored in the application.yml file in my git repository. I tried adding the application.yml to my gitignore file, but that just crashes my app.
How do I hide this password in my git repository so that my app still works, and I don't have to put my app into a private repository?