0

https://github.com/ryanatwork/sign-in-with-linkedin

This example rails application that lets a user log in with LinkedIn requires that the "rails server" command in the terminal be prefaced by 'CONSUMER_KEY=[consumer key] CONSUMER_SECRET=[consumer secret]' so that the whole command looks like:

CONSUMER_KEY=[consumer key] CONSUMER_SECRET=[consumer secret] rails server

The linkedin login obviously won't work with a consumer key/secret, but I'm having trouble hardcoding my consumer key/secret into the app so that I can deploy to Heroku successfully, but am not having any luck. I've tried in several different config and controller files without any luck. Help appreciated!

4

2 回答 2

1

不要硬编码到heroku。您可以在 Heroku 中使用环境变量来设置 CONSUMER_KEY 和 CONSUMER_SECRET。

以下是 Heroku 的文档: https ://devcenter.heroku.com/articles/config-vars

于 2012-07-11T16:42:41.723 回答
1

当您部署到 Heroku 时,您需要使用以下heroku config命令设置这些变量:

heroku config:add CONSUMER_KEY=[consumer key]

如果您使用Foreman来启动您的服务器(就像 Heroku 在其末尾所做的那样),那么您可以从本地文件中加载这些变量,该文件永远不会提交到您的源代码管理中(您希望在源代码管理中包含这些秘密细节)

于 2012-07-11T16:43:07.027 回答