Is there a way to use CarrierWave with Azure these days?

187 Views Asked by At

I was using CarrierWave gem + google cloud to upload and store files from my project. Unfortunately I need to switch to Azure cloud so I'm trying to implement the same mechanism as previous (basically replace config/initializers/carrier_wave.rb with proper values). My current carrier_wave.rb:

CarrierWave.configure do |config|
  if Rails.application.config.ci
    config.storage = :file
    config.enable_processing = false
  else
    config.storage = :fog
    config.fog_provider = 'fog/google'
    config.fog_credentials = {
      provider: 'Google',
      google_project: Rails.application.config.google_cloud_storage_project,
      google_json_key_string: Rails.application.config.google_cloud_storage_json_key_string
    }
    config.fog_directory = Rails.application.config.google_cloud_storage_bucket_name
  end
end

Surprisingly, I don't see anywhere to do it the easy way. I was trying to use https://github.com/unosk/carrierwave-azure but it's 10y old gem which doesn't seem to be maintained.

Is no one using CarrierWave + Azure these days or is there a modern way to do it?

[EDIT]

I tried to use fog-azure-rm as suggested by @engineersmnky in the comment but to resolve dependencies, bundler has to downgrade few gems e.g.:

Using faraday 0.17.6 (was 1.10.3)
Using faraday_middleware 0.14.0 (was 1.2.0)
Using elasticsearch-api 7.5.0 (was 7.17.7)
Using elasticsearch-transport 7.5.0 (was 7.17.7)
Using elasticsearch 7.5.0 (was 7.17.7)

That will break the app

0

There are 0 best solutions below