ruby-on-rails – 在英雄设计中找不到ENV [‘SECRET_KEY’]
发布时间:2020-12-16 21:59:41 所属栏目:百科 来源:网络整理
导读:现在,not version-controlling your secret keys的这个要点非常棒,现在我已经使用了几次,不再使用我的rails secret-key-base版本. 我尝试使用它来设计hero_key的秘密密钥,我的尝试失败了.它在开发中工作正常,但拒绝让我推动英雄 – 说我创造的设计钥匙(与上
现在,not version-controlling your secret keys的这个要点非常棒,现在我已经使用了几次,不再使用我的rails secret-key-base版本.
我尝试使用它来设计hero_key的秘密密钥,我的尝试失败了.它在开发中工作正常,但拒绝让我推动英雄 – 说我创造的设计钥匙(与上述要点相同)没有设定. 我使用硬编码的秘密密钥(检入git)工作,但是当我使用以下命令时: Devise.setup do |config| config.secret_key = ENV['DEVISE_SECRET_KEY'] ... (与相关的环境变量三重检查,它在那里) 在推送到英雄时,似乎没有预编译资产 $ git push heroku master ... (bundle stuff here) Running: rake assets:precompile rake aborted! Devise.secret_key was not set. Please add the following to your Devise initializer: config.secret_key = '0cfa796871e0... /tmp/build_.../vendor/bundle/ruby/1.9.1/gems/devise-3.1.1/lib/devise/rails/routes.rb:446:in `raise_no_secret_key' /tmp/build_.../vendor/bundle/ruby/1.9.1/gems/devise-3.1.1/lib/devise/rails/routes.rb:195:in `devise_for' /tmp/build_.../config/routes.rb:2:in `block in <top (required)>' ...( rest of the long stacktrace with little of interest here) 当在路径目录中运行“devise_for”时,会出现错误. MyApp::Application.routes.draw do devise_for :users,:path_names => { :sign_in => 'login',:sign_out => 'logout'} 实际设计宝石的相关线是: raise_no_secret_key unless Devise.secret_key 所以真的只是检查secret_key是否被设置. 只是为了确认…我检查了heroku配置,我确实把这个秘密密钥放在环境中. DEVISE_SECRET_KEY: 3f844454bee...(more here) RAILS_SECRET_KEY_BASE: 04bf569d4e...(more here) 因为它是一个耙子任务而不是应用程序 – 我猜这就是为什么它不能得到ENV? 任何关于我可能开始寻找解决方案的想法? 解决方法
您之前(在编译时)要使用
config var它实际上是可用于您的应用程序(在slug编译时间).
尝试打开Heroku Labs: user-env-compile 我怀疑它会解决问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |