作者:Libra | 来源:互联网 | 2023-05-19 19:01
Imdevelopingawebappwhichconnectstoacoupleofservices,forexample:NewRelic,Mailgun.我正
I'm developing a web app which connects to a couple of services, for example: New Relic, Mailgun.
我正在开发一个web应用程序,它连接到一些服务,例如:New Relic, Mailgun。
For New Relic, I have an API key. For Mailgun, I have a login and a password. I obviously don't want to check them into version control (and push them to Github). The repository is eventually going to be public.
对于New Relic,我有一个API键。对于Mailgun,我有一个登录名和密码。显然,我不想将它们检入版本控制(并将它们推到Github)中。存储库最终将是公共的。
I deploy with capistrano, and I have the following line in my deploy.rb at the moment:
我与capistrano一起部署,在我的部署中有如下一行。rb:
set :app_environment, "PORT=3005 GA_CODE=UA-123456-1 GA_URL=myawesomedomain.com NEW_RELIC_LICENSE_KEY=1234abc1234abc1234abc MAILGUN_USER=postmaster@myawesomedomain.com MAILGUN_PASS=321cba"
This then creates an upstart job for my node app with those variables specified as environment variables:
这将为我的节点应用程序创建一个新的作业,这些变量指定为环境变量:
NODE_ENV=production PORT=3005 /* more of the same */ node app.js
NODE_ENV=生产端口=3005 /*更多相同的*/节点app.js
Deploy.rb isn't checked into version control so it seemed like a good way to keep things safe. However, I'm not sure if this is the correct way to do this: it feels quite hackish and I'm sure there are better ways to keep my passwords safe? Thanks.
部署。rb没有被检查到版本控制,所以它看起来是一个安全的好方法。然而,我不确定这是否是正确的方式:它感觉相当陈腐,我确信有更好的方法来保证我的密码安全?谢谢。
2 个解决方案