mirror of https://github.com/rails/rails
Merge pull request #52863 from zzak/asto/deprecate-azure
Deprecate ActiveStorage::Service::AzureStorageService
This commit is contained in:
commit
9356db3d4b
|
@ -1,3 +1,7 @@
|
|||
* Deprecate `ActiveStorage::Service::AzureStorageService`.
|
||||
|
||||
*zzak*
|
||||
|
||||
* Improve `ActiveStorage::Filename#sanitized` method to handle special characters more effectively.
|
||||
Replace the characters `"*?<>` with `-` if they exist in the Filename to match the Filename convention of Win OS.
|
||||
|
||||
|
|
|
@ -15,6 +15,13 @@ module ActiveStorage
|
|||
attr_reader :client, :container, :signer
|
||||
|
||||
def initialize(storage_account_name:, storage_access_key:, container:, public: false, **options)
|
||||
ActiveStorage.deprecator.warn <<~MSG.squish
|
||||
`ActiveStorage::Service::AzureStorageService` is deprecated and will be
|
||||
removed in Rails 8.1.
|
||||
Please try the `azure-blob` gem instead.
|
||||
This gem is not maintained by the Rails team, so please test your applications before deploying to production.
|
||||
MSG
|
||||
|
||||
@client = Azure::Storage::Blob::BlobService.create(storage_account_name: storage_account_name, storage_access_key: storage_access_key, **options)
|
||||
@signer = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(storage_account_name, storage_access_key)
|
||||
@container = container
|
||||
|
|
|
@ -20,4 +20,22 @@ class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
|
|||
ActiveStorage::Service::Configurator.build(:bigfoot, {})
|
||||
end
|
||||
end
|
||||
|
||||
test "azure service is deprecated" do
|
||||
msg = <<~MSG.squish
|
||||
`ActiveStorage::Service::AzureStorageService` is deprecated and will be
|
||||
removed in Rails 8.1.
|
||||
Please try the `azure-blob` gem instead.
|
||||
This gem is not maintained by the Rails team, so please test your applications before deploying to production.
|
||||
MSG
|
||||
|
||||
assert_deprecated(msg, ActiveStorage.deprecator) do
|
||||
ActiveStorage::Service::Configurator.build(:azure, azure: {
|
||||
service: "AzureStorage",
|
||||
storage_account_name: "test_account",
|
||||
storage_access_key: Base64.encode64("test_access_key").strip,
|
||||
container: "container"
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue