0
我試圖將我的rails 4項目連接到Azure,我使用carrierwave和fog來管理和存儲圖像。Carrierwave/Fog-azure:azure不是公認的提供商(ArgumentError)
這是啓動服務器或控制檯時,我得到的錯誤:
/Users/giulio/.rvm/gems/[email protected]_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/[email protected]_project/gems/fog-core-1.32.0/lib/fog/storage.rb:22:in `new'
from /Users/giulio/.rvm/gems/[email protected]_project/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:83:in `eager_load_fog'
from /Users/giulio/.rvm/gems/[email protected]_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初始化爲:
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'