gpt4 book ai didi

ruby-on-rails - 载波/雾 azure : azure is not a recognized provider (ArgumentError)

转载 作者:行者123 更新时间:2023-12-03 03:13:55 25 4
gpt4 key购买 nike

我正在尝试将我的 Rails 4 项目连接到 Azure,我使用载波和雾来管理和存储图像。

这是我在启动服务器或控制台时遇到的错误:

/Users/giulio/.rvm/gems/ruby-2.2.1@my_project/gems/fog-core-1.32.0/lib/fog/core/services_mixin.rb:12:in `new': azure is not a recognized provider (ArgumentError)
from /Users/giulio/.rvm/gems/ruby-2.2.1@my_project/gems/fog-core-1.32.0/lib/fog/storage.rb:22:in `new'
from /Users/giulio/.rvm/gems/ruby-2.2.1@my_project/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:83:in `eager_load_fog'
from /Users/giulio/.rvm/gems/ruby-2.2.1@my_project/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:96:in `fog_credentials='
from /Users/giulio/Documents/rails/my_project/config/initializers/carrier_wave.rb:7:in `block in <top (required)>'

我的 gemfile 中有:

gem 'carrierwave'
gem 'fog'
gem 'fog-azure'

载波初始化器是:

CarrierWave.configure do |config|
if Rails.env.test?
config.storage = :file
config.enable_processing = false
else
config.storage = :fog
config.fog_credentials = Rails.application.secrets.fog_credentials.symbolize_keys
config.fog_directory = "my_directory"
config.fog_public = true
config.fog_attributes = {'Cache-Control'=>'public, max-age=315576000'}
end
end

我的 Secrets.yml 包含:

  fog_credentials:
provider: 'azure'
azure_sub_id: '12a2341c-22ac-1561-5ed2-17865d910ba4'
azure_pem: '~/secret.pem'
azure_api_url: 'usnorth.management.core.windows.net'

最佳答案

检查fog-azure gem代码,我发现fog-azure仅处理雾的“计算”模块,而rierwave使用“存储”模块。

据此我了解到,fog-azure 只能用于管理服务器(即启动、停止、配置),不能用于存储

我还发现了carrierwave-azure gem 让载波支持 azure,我会尝试这个。

关于ruby-on-rails - 载波/雾 azure : azure is not a recognized provider (ArgumentError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32047645/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com