Skip to content

Commit cc3ec13

Browse files
Merge pull request #2 from hameesakhan/patch-1
Changed config key named `prefix` with `root` for better compatibility
2 parents 3ac804e + d6b0d6e commit cc3ec13

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/AzureStorageBlobAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
final class AzureStorageBlobAdapter extends FilesystemAdapter
1717
{
1818
/**
19-
* @param array{connection_string: string, container: string, prefix?: string} $config
19+
* @param array{connection_string: string, container: string, prefix?: string, root?: string} $config
2020
*/
2121
public function __construct(array $config)
2222
{
2323
$serviceClient = BlobServiceClient::fromConnectionString($config['connection_string']);
2424
$containerClient = $serviceClient->getContainerClient($config['container']);
25-
$adapter = new AzureBlobStorageAdapter($containerClient, $config['prefix'] ?? '');
25+
$adapter = new AzureBlobStorageAdapter($containerClient, $config['prefix'] ?? $config['root'] ?? '');
2626

2727
parent::__construct(
2828
new Filesystem($adapter, $config),

src/AzureStorageBlobServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public function boot(): void
2626
if (isset($config['prefix']) && ! is_string($config['prefix'])) {
2727
throw new \InvalidArgumentException('The [prefix] must be a string in the disk configuration.');
2828
}
29+
30+
if (isset($config['root']) && ! is_string($config['root'])) {
31+
throw new \InvalidArgumentException('The [root] must be a string in the disk configuration.');
32+
}
2933

3034
return new AzureStorageBlobAdapter($config);
3135
});

0 commit comments

Comments
 (0)