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

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

问题描述

运行 heroku运行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 =< access key> 我用带引号和无引号的版本替换了实际的关键。当我运行heroku config时,这些键会显示出来,例如, S3_ACCESS_KEY:

在我开始编写本节之前, 11.4)重新上传图像。顺便说一句,我知道费加罗的宝石;不过,我想尝试遵循教程的方法。我错过了什么?任何想法将不胜感激。感谢!

解决方案

继续使用Heroku,在应用程序中进入设置,点击Reveal Config Vars。



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

  S3_BUCKET:您的存储桶名称在此处
S3_ACCESS_KEY:xxxxx
S3_SECRET_KEY:xxxx

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

  CarrierWave.configure do | config | 
config.root = Rails.root.join('tmp')#添加这些...
config.cache_dir ='carrierwave'#...两行

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


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!

解决方案

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

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天全站免登陆