Search code examples
ruby-on-railsauthenticationpasswordsgithub

Hiding my sensitive information (e.g. password) from github


I just set up Devise (rails authentication plugin) to send a confirmation email upon sign up. This involved my putting the following into my environment.rb file:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
   :tls => true,
   :address => "smtp.gmail.com",
   :port => 587,
   :domain => "gmail.com",
   :authentication => :login,
   :user_name => "[my email]",
   :password => "[my pass]"
 }

I obviously don't want to push this up to github with [my pass] just sitting there. Is there a standard practice here?


Solution

  • The standard is to put your configuration settings in one YAML file which isn't included in your repo.

    Then you simply get the data from it.

    Check Railscast "#85 YAML Configuration File" to see it in action.