-
Notifications
You must be signed in to change notification settings - Fork 0
Azure Blob Storage support #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
mzur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use azure-oss/storage-blob-laravel instead of adding a custom implementation of the filesystem adapter here. This has to be added as a requirement to composer.json. The current state is missing league/flysystem-azure-blob-storage that is used here but this package is abandoned in favor of the azure-oss stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see the StorageAdapter and FilesystemAdapter in there. This is no longer required if you use azure-oss/storage-blob-laravel, as everything is provided by the package. Also the requirements are still not defined in composer.json.
|
I sent a PR to the adapter repo and also asked for a new release that exposes the temporary URL support. |
|
If users can't provide account credentials to generate SASes for temporary URLs on the fly, the adapter could fall back to the static SAS that the user has to update periodically by hand. Here is a possible implementation in 9a10
> use League\Flysystem\UnableToGenerateTemporaryUrl;
25c26
< $adapter = new AzureBlobStorageAdapter($containerClient, $config['prefix'] ?? $config['root'] ?? '');
---
> $adapter = new AzureBlobStorageAdapter($containerClient, $config['prefix'] ?? $config['root'] ?? '', useDirectPublicUrl: true);
38a40,44
> public function providesTemporaryUrls()
> {
> return true;
> }
>
49,53c55,63
< return $this->adapter->temporaryUrl(
< $path,
< $expiration,
< new Config(array_merge(['permissions' => 'r'], $options))
< );
---
> try {
> return $this->adapter->temporaryUrl(
> $path,
> $expiration,
> new Config(array_merge(['permissions' => 'r'], $options))
> );
> } catch (UnableToGenerateTemporaryUrl $e) {
> return $this->url($path);
> } |
@mzur It works using the azurite emulator and the URLs provided by Rob Skelly (I'll forward you the mail). Could you please have a look, especially at the tests since I don't have any idea how the whole thing in PHP works.