在“ validate_options”中:缺少必需的参数:aws_access_key_id,aws_secret_access_key(ArgumentError)

时间:2018-10-26 21:48:13

标签: ruby-on-rails amazon-web-services environment-variables fog figaro-ruby

一切都很棒。在我签出新分支之前,现在我收到此错误。我使用figaro生成了application.yml来存储aws凭证的env变量。我已经能够成功部署到heroku并使用aws密钥将图片等上传到我的存储桶中。然后我签出一个新的分支和此错误。我什至回到了旧的分支,那里的一切都只是桃色,这个错误不会消失。我很沮丧。我什至进入终端并回显$ aws_access_key_id,但没有得到零,我获得了访问密钥。东西没加起来...

fog.rb

CarrierWave.configure do |config|
  config.fog_credentials = {
    provider: 'AWS',
    aws_access_key_id: ENV['aws_access_key_id'],
    aws_secret_access_key: ENV['aws_secret_access_key'],
    region: 'us-east-1'
  }

      config.fog_directory = ENV['AWS_BUCKET']

  if Rails.env.development? || Rails.env.test?
    CarrierWave.configure do |config|
      config.storage = :file
    end
  end

  # Use AWS storage if in production
  if Rails.env.production?
    CarrierWave.configure do |config|
      config.storage = :fog
    end
  end
end

application.yml

aws_access_key_id: "key"
aws_secret_access_key: "key"

0 个答案:

没有答案