Ruby on rails:heroku:缺少“生产"环境的"secret_key_base" [英] ruby on rails: heroku: Missing `secret_key_base` for 'production' environment

查看:61
本文介绍了Ruby on rails:heroku:缺少“生产"环境的"secret_key_base"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将密钥添加到了heroku config var中,但是仍然出现错误.

I added the key into heroku config var, but I'm still getting the error.

这是正确的方法吗?当我从其他来源读到的时候,我忽略了secrets.yml,这不是将其公开发布的好主意.

Is this the correct way? I ignored secrets.yml as I read from other sources that its not a good idea to push this to the public.

在heroku配置变量中:

in the heroku config var:

[key] SECRET_KEY_BASE
[value] 3280570382948240938

secrets.yml

production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

我还是在做错什么?

此外,如果我将秘密密钥放入heroku的config变量中,其他开发人员也不会看到吗?所以,那还不是公众吗?我一直想知道这个概念.

Furthermore, if I put my secret keys into heroku's config variable, don't other developers get to see this too? So, isn't that still kind of public? I've always wondered this concept.

推荐答案

您可以使用 heroku config

首先在终端上运行以下命令生成密钥

first generate secret key with run below command on terminal

rake secret

现在在下面的命令上使用该键

Now use that key on below command

heroku config:set SECRET_KEY_BASE='put here new generated key'

您可以参考此链接以获取更多参考

you can refer this link for more refference

https://devcenter.heroku.com/articles/config-vars

这篇关于Ruby on rails:heroku:缺少“生产"环境的"secret_key_base"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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