Errno :: ENOENT(没有这样的文件或目录@ rb_sysopen - aws.yml)在带回形针的rails中

时间:2017-11-18 04:50:54

标签: ruby-on-rails amazon-web-services amazon-s3 paperclip elastic-beanstalk

Rais应用程序部署在aws弹性beantalk中。图像未从资源文件夹加载。我正在尝试使用s3存储桶来存储资产。我收到了一个错误...

aws.yml

 production:
  access_key_id: 123333231331....
  secret_access_key: 12212dddddd........

production.rb

  config.paperclip_defaults = {
  :storage => :s3,
  :preserve_files => true,
  :s3_credentials => 'aws.yml',
  :s3_region => 'ap-south-1',
  :s3_host_name => 's3.ap-south-1.amazonaws.com',
  :bucket => 'xxxxxx'
}

我还在s3存储桶中授予公共访问权限。

anyone: read write

...宝石

gem 'aws-sdk', '~> 2.10', '>= 2.10.85'
配置文件夹中的

aws.yml文件夹 - config / aws.yml

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用该文件的路径,如问题底部所示::s3_credentials => 'config/aws.yml'

否则,您可能需要从YAML显式加载文件并将其传递到:

require 'yaml'
...
# again, perhaps using config/aws.yml, have a play
:s3_credentials => YAML.load_file('aws.yml')
...

这些都有帮助吗?