简体   繁体   English

向heroku应用程序添加敏感数据(ruby on rails)

[英]Adding sensitive data to heroku application (ruby on rails)

I am trying to set up a mailer with my heroku application. 我试图用我的heroku应用程序设置一个邮件程序。 I fear if I push up my production.rb, my gmail password will be exposed. 我担心如果我推高production.rb,我的gmail密码将被泄露。 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 您可以使用环境变量: 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. Env变量也是一个不错的选择,因为它们可以与您使用的任何提供程序一起使用,因此,如果您从Heroku迁移到另一个平台,则无需对代码进行任何更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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