0
0
Fork 0

Paperclip: add support for Azure blob storage (#23607)

This commit is contained in:
Misty De Méo 2023-07-19 00:02:49 -07:00 committed by GitHub
parent 4c18928a93
commit b848ba3867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 1 deletions

View file

@ -131,6 +131,26 @@ elsif ENV['SWIFT_ENABLED'] == 'true'
fog_host: ENV['SWIFT_OBJECT_URL'],
fog_public: true
)
elsif ENV['AZURE_ENABLED'] == 'true'
require 'paperclip-azure'
Paperclip::Attachment.default_options.merge!(
storage: :azure,
azure_options: {
protocol: 'https',
},
azure_credentials: {
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
storage_access_key: ENV['AZURE_STORAGE_ACCESS_KEY'],
container: ENV['AZURE_CONTAINER_NAME'],
}
)
if ENV.has_key?('AZURE_ALIAS_HOST')
Paperclip::Attachment.default_options.merge!(
url: ':azure_alias_url',
azure_host_alias: ENV['AZURE_ALIAS_HOST']
)
end
else
Paperclip::Attachment.default_options.merge!(
storage: :filesystem,