This Gem was forked from https://github.com/Syndicode/shrine-storage Due to some small bugs from a typo and MIME type wasn't set
Add this lines to your application's Gemfile:
...
gem 'shrine', '>= 3.0.0.beta3', '< 4'
gem 'shrine-storage-azureblob'
...
And then execute:
$ bundle
Or install it yourself as:
$ gem install shrine-storage-azureblob
- Create file config/initializers/shrine.rb
require 'shrine'
require "shrine/storage/azure_blob"
azure_options = {
public: false, # optional: dafault to false - can be set to true (if storage blob is public readable)
scheme: :https, # optional: defaults to https - http possible if storage blob is configured for non secure access
account_name: ENV.fetch('AZURE_ACCOUNT_NAME'),
access_key: ENV.fetch('AZURE_ACCESS_KEY'),
container_name: ENV.fetch('AZURE_CONTAINER')
}
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new("tmp", prefix: "uploads/cache"),
store: Shrine::Storage::AzureBlob.new(**azure_options)
}
- Acessing the
url
# assuming your instance has a file these optional arguments may be used
# expiry must be a Time turned to String
instance.file.url(public: false, scheme: :https, expiry: 24.hours.from_now.to_s)
- Additional info: Shrine Docs AzureStorageBlob Docs
Bug reports and pull requests are welcome on GitHub at https://github.com/TQsoft-GmbH/shrine-storage-azureblob. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Shrine::Storage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.