0
我使用Rails 3.2 carrierwave
和sitemap_generator
。sitemap_generator和Carrierwave - 更改S3權限,但只是暫時的
該文件正確上傳,但權限中未公開的S3。
- 如何才能設置此「sitemap.xml.gz」文件的權限?
我的S3桶通常只開放標記:
CarrierWave.configure do |config|
config.storage = :fog
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => ENV['S3_KEY'],
:aws_secret_access_key => ENV['S3_SECRET']
}
config.fog_directory = ENV['S3_BUCKET_NAME']
# -> THIS is what sitemap_generator likes:
# -> config.permissions = "0666"
# here I set my permissions:
config.fog_public = false
config.fog_attributes = {'Cache-Control' => 'max-age=315576000'}
end
和我sitemap_generator寶石initalizer是:
# WaveAdapter: carrierwave
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
SitemapGenerator::Sitemap.sitemaps_host = "http://s3.amazonaws.com/#{ENV['S3_BUCKET_NAME']}/"
SitemapGenerator::Sitemap.public_path = 'tmp/'
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
謝謝!