0

I am trying to set up a mailer with my heroku application. I fear if I push up my production.rb, my gmail password will be exposed. How can I prevent this?

Production.rb:
  ActionMailer::Base.smtp_settings = {
    :address        => "smtp.gmail.com",
    :port           => 587,
    :authentication => :plain,
    :user_name      => "[email protected]",
    :password       => "**********"
  }
2

1 Answer 1

2

You can use environment variables: https://devcenter.heroku.com/articles/config-vars

It's a best-practice to never include sensitive information in your repo. Env variables are also a good way to go, because they'll work with whatever provider you use, so if you move from Heroku to another platform, you won't need to make any changes to your code.

Sign up to request clarification or add additional context in comments.

2 Comments

... and look into the various available gems that allow you to reference ENV variables from within your app on development environments without setting them on your dev system also.
Thank you. Thats was very helpful and works perfectly!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.