如何让应用程序秘密保密? [英] How to keep the app secret a secret?

查看:203
本文介绍了如何让应用程序秘密保密?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



application.secret = asdfadsfdasf 每个新的Play应用程序都会在其配置文件中生成一个新的应用程序密钥。 >



我正在开发一个将部署在Heroku上的开源应用程序。我怎么能保密这个应用程序的秘密(例如,没有将它提交到源代码控制中)?



应用程序的秘密究竟在哪里使用?也许对我有限的目的而言,我并不需要保守秘密吗?

变量。

conf / application.conf中只需替换

 application.secret = abc123 ... 

p>

  application.secret = $ {APP_SECRET} 

,然后在Heroku中将此配置变量设置为:

  $ heroku config:add APP_SECRET = abc123 ... 

现在您可以在每个应用程序的基础上管理机密并避免将它们检入版本控制。

Every new Play app gets a new application secret generated into its config file.

application.secret=asdfadsfdasf

I'm developing an open source app that will be deployed on Heroku. How can I keep the app secret a secret (e.g. no commit it into source control)?

Where exactly is the app secret used? Perhaps for my limited purposes I don't really have to keep it a secret?

解决方案

You can externalize the secret as an environment variable.

In conf/application.conf Simply replace

application.secret=abc123...

with

application.secret=${APP_SECRET}

and then set this config var in Heroku with:

$ heroku config:add APP_SECRET=abc123...

Now you can manage secrets on a per-app basis and avoid checking them into version control.

这篇关于如何让应用程序秘密保密?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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