heroku - 缺少必需的参数:aws_access_key_id、aws_secret_access_key,遵循 Hartl 教程 [英] heroku - Missing required arguments: aws_access_key_id, aws_secret_access_key, following Hartl tutorial

查看:20
本文介绍了heroku - 缺少必需的参数:aws_access_key_id、aws_secret_access_key,遵循 Hartl 教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 heroku run rake db:migrate,我收到此错误:缺少必需参数:aws_access_key_id, aws_secret_access_key.

我做了 SO 问题 25596504 中推荐的更正,特别是将文件 carrier_wave.rb 更改为 carrierwave.rb ,但没有运气.我正在关注 Hartl 教程第 688 页,它指定将它们添加为 $heroku config:set S3_ACCESS_KEY= 我用实际密钥的带引号和不带引号的版本替换了 ''.当我运行 heroku 配置时会显示这些键,例如 S3_ACCESS_KEY:

在我开始处理本教程的本节 (11.4) 重新上传图像之前,该应用程序正在运行.顺便说一下,我知道费加罗宝石;但是,我想尝试遵循教程的方法.我错过了什么?任何想法将不胜感激.谢谢!

Running heroku run rake db:migrate, I get this error: Missing required arguments: aws_access_key_id, aws_secret_access_key.

I made the correction recommended in SO question 25596504, specifically changing the file carrier_wave.rb to carrierwave.rb with no luck. I am following the Hartl tutorial page 688 which specifies adding them as $heroku config:set S3_ACCESS_KEY=<access key> I replaced the '' with quoted and unquoted versions of the actual key. The keys show when I run heroku config, e.g., S3_ACCESS_KEY:

The application was working before I began working on this section (11.4) of the tutorial re uploading images. I, incidentally, know about the Figaro gem; however, I'd like to try following the tutorial's approach. What am I missing? Any thoughts would be appreciated. Thanks!

推荐答案

继续使用 Heroku,在您的应用程序上,转到设置,点击显示配置变量.

Go on Heroku, on your application, go to settings, hit Reveal Config Vars.

点击右侧的编辑并在那里输入您的秘密:

Click on on Edit on the right side and enter your secrets there:

S3_BUCKET: name of your bucket goes here
S3_ACCESS_KEY: xxxxx
S3_SECRET_KEY: xxxx

在 config/initializers/carrierwave.rb 或任何你输入你的秘密的地方应该有:

On config/initializers/carrierwave.rb or wherever you're entering your secrets should have:

CarrierWave.configure do |config|
  config.root = Rails.root.join('tmp') # adding these...
  config.cache_dir = 'carrierwave' # ...two lines

  config.fog_credentials = {
    :provider               => 'AWS',                        # required
    :s3_access_key_id      => ENV['S3_ACCESS_KEY'],                        # required
    :s3_secret_access_key  => ENV['S3_SECRET_KEY'],                     # required
    :region                 => 'eu-west-1',                  # optional, defaults to 'us-east-1'
    :host                   => 's3.example.com',             # optional, defaults to nil
    :endpoint               => 'https://s3.example.com:8080' # optional, defaults to nil
  }
  config.fog_directory  = ENV['S3_Bucket']                             # required
  config.fog_public     = false                                   # optional, defaults to true
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}  # optional, defaults to {}
end

这篇关于heroku - 缺少必需的参数:aws_access_key_id、aws_secret_access_key,遵循 Hartl 教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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