首页 文章

如何将API密钥添加到Heroku?

提问于
浏览
1

我正在尝试向Heroku添加API密钥,因为我的AngularJS / NodeJS应用程序需要使用它们,但我遇到了麻烦 . 我尝试使用这个插件https://github.com/ddollar/heroku-config但不是't able to push the keys (it just hangs in there after I type in heroku:config push. Same thing happens with other commands). The plugin is no longer maintained so I was wondering if there'另一种方法来解决这个问题 .

目前我将我的密钥存储在我添加到.gitignore的.env文件中,我提交并推送其他文件 . 您建议将什么步骤添加到Heroku?

1 回答

  • 1

    正如Skelly所说,您可以通过设置选项卡上的Heroku仪表板添加API密钥等作为配置变量 . 您还可以添加/更新等via the CLI - 例如 . heroku config:set MY_API_KEY=12345 . 当然,您必须安装Heroku Toolbelt才能使用CLI .

    如果你想更多地了解Heroku为什么会这样,你应该阅读12factor.net来理解这个哲学 .

相关问题