Use Azure driver on lumen
cachila opened this issue · 4 comments
Hi, I have tried to use this on a Lumen environment. Previously I use S3 filesystem and it works great, but when I install your library with composer install and add the azure disk this error come up. Am I missing something?
lumen.ERROR: InvalidArgumentException: Driver [azure] is not supported. in /var/www/vendor/illuminate/filesystem/FilesystemManager.php:126 Stack trace: #0 /var/www/vendor/illuminate/filesystem/FilesystemManager.php(102): Illuminate\Filesystem\FilesystemManager->resolve('azure') #1 /var/www/vendor/illuminate/filesystem/FilesystemManager.php(79): Illuminate\Filesystem\FilesystemManager->get('azure') #2 /var/www/vendor/illuminate/support/Facades/Facade.php(221): Illuminate\Filesystem\FilesystemManager->disk('azure')
Can you please provide your config/filesystems.php
?
Hi, Thanks for the response.
Here it is
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
'spaces' => [
'driver' => 's3',
'key' => env('DO_SPACES_KEY'),
'secret' => env('DO_SPACES_SECRET'),
'endpoint' => env('DO_SPACES_ENDPOINT', 'https://nyc3.digitaloceanspaces.com'),
'region' => env('DO_SPACES_REGION', 'nyc3'),
'bucket' => env('DO_SPACES_BUCKET', 'develop'),
],
'azure' => [
'driver' => 'azure',
'name' => env('AZURE_STORAGE_NAME'),
'key' => env('AZURE_STORAGE_KEY'),
'container' => env('AZURE_STORAGE_CONTAINER'),
'url' => env('AZURE_STORAGE_URL'),
'prefix' => null,
],
],
I thought the issue was that the provider wasn't being registered, so I added this line to bootstrap/app.php
$app->register(Matthewbdaly\LaravelAzureStorage\AzureStorageServiceProvider::class);
but the following error appears:
lumen.ERROR: RuntimeException: A facade root has not been set. in /var/www/vendor/illuminate/support/Facades/Facade.php:218 Stack trace: #0 /var/www/vendor/matthewbdaly/laravel-azure-storage/src/AzureStorageServiceProvider.php(36)
Any clue on what is going on?
I have solved the issue by registering after withFacades()
$app->withFacades();
$app->register(Matthewbdaly\LaravelAzureStorage\AzureStorageServiceProvider::class);
Thanks again for helping me.
Yes, that makes sense - if facades weren't enabled, you wouldn't be able to extend the Storage facade.
I imagine it may be possible to amend it to extend the Filesystem object to add Azure support without the need to rely on facades, and may have a look in the near future.