简体   繁体   中英

Adding sensitive data to heroku application (ruby on rails)

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      => "whatever@gmail.com",
    :password       => "**********"
  }

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM