从 github 隐藏我的敏感信息(例如密码) [英] Hiding my sensitive information (e.g. password) from github

查看:101
本文介绍了从 github 隐藏我的敏感信息(例如密码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚设置了 Devise(rails 身份验证插件)以在注册时发送确认电子邮件.这涉及到我将以下内容放入我的 environment.rb 文件中:

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]"
 }

我显然不想在 [my pass] 坐在那里的情况下将其推送到 github.这里有标准做法吗?

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

推荐答案

标准是将您的配置设置放在一个 YAML 文件中,该文件不包含在您的存储库中.

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.

检查 Railscast "#85 YAML 配置文件" 以查看它的实际效果.

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

这篇关于从 github 隐藏我的敏感信息(例如密码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆