【发布时间】:2019-01-29 10:51:14
【问题描述】:
我正在使用sitemap_generator 在我的 RoR 项目中生成站点地图。到目前为止一切正常。我在 Heroku 上托管我的项目,它不允许写入本地文件系统。我仍然需要一些写入权限,因为在上传之前需要写出站点地图文件。但是我必须使用 microsoft azure 来存储我的站点地图。sitemap_generator 中列出的适配器不包括 azure。有人可以指出我为 azure 编写适配器的正确方向。
参考this 文章中的“配置载波”,我对代码进行了一些更改。
但我不确定仅编辑初始化文件是否会有所帮助。在上面的文章中,Carrierwave 指向 WaveAdapter here,它使用 CarrierWave::Uploader::Base 上传到 CarrierWave 支持的任何服务
config/initializers/azure.rb
Azure.configure do |config|
config.cache_dir = "#{Rails.root}/tmp/"
config.storage = :microsoft_azure
config.permissions = 0666
config.microsoft_azure_credentials = {
:provider => 'azure',
:storage_account_name => 'your account name',
:storage_access_key => 'your key',
}
config.azure_directory = 'container name'
end
请帮忙!
【问题讨论】:
标签: ruby-on-rails azure sitemap-generator-gem