2014-06-27 84 views
0

我使用Rails 3.2 carrierwavesitemap_generatorsitemap_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/' 

謝謝!

回答

0

它看起來像config.fog_public設置爲false;您應該將其設置爲true以啓用S3上的公開查看。