我被这个难住了。我正在使用带有 Fog 的 Carrierwave 来处理 Heroku 上托管的应用程序的缩略图上传,并且图像 url 似乎没有正确生成。
我尝试了三种不同的方式设置我的配置文件:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'yyy',
}
config.fog_host = 'https://s3.amazonaws.com/statics.gallery.spongecell.com'
end
使图像网址正常工作,但我无法保存新图像而不会在我的日志中出现疯狂错误(数百行长,在说密钥不匹配之后。)
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'yyy',
}
config.fog_directory = 'statics.gallery.spongecell.com'
config.fog_host = 'https://s3.amazonaws.com/'
end
使上传工作,但不是图像!图片网址中缺少存储桶名称:http: //s3.amasonaws.com//uploads/blah/etc
最奇怪的是:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'yyy',
}
config.fog_host = 'https://s3.amazonaws.com/statics.gallery.spongecell.com'
config.fog_public = false
end
两者都可以工作,但图像 url 附加了 s3 密钥(不好!),而且速度很慢。知道这里可能发生了什么吗?
提前致谢!