Skip to content

Commit

Permalink
docs(azure-storage-blob): enhanced parameter documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
itpropro committed Jan 29, 2025
1 parent 2212e39 commit 85e81ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/2.drivers/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ The driver supports the following authentication methods:
- `containerName`: The name of the blob container to use. Defaults to `unstorage`.
- `accountKey`: The account key to use for authentication. This is only required if you are using `AzureNamedKeyCredential`.
- `sasKey`: The SAS token to use for authentication. This is only required if you are using `AzureSASCredential`.
- `sasUrl`: The SAS URL of the storage account. This is an alternative to providing `accountName` and `sasKey` separately. The URL can be either:
- A storage account URL: `https://<account>.blob.core.windows.net?<sas-token>`
- A container URL: `https://<account>.blob.core.windows.net/<container>?<sas-token>` you must specify the `containerName` option
- `connectionString`: The storage accounts' connection string. `accountKey` and `sasKey` take precedence.
- `endpointSuffix`: Storage account endpoint suffix. Needs to be changed for Microsoft Azure operated by 21Vianet, Azure Government or Azurite. Defaults to `.blob.core.windows.net`.

## Azure Table Storage

Expand Down
6 changes: 5 additions & 1 deletion src/drivers/azure-storage-blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export default defineDriver((opts: AzureStorageBlobOptions) => {
credential
);
} else if (opts.sasUrl) {
if (opts.containerName) {
if (
opts.containerName &&
opts.sasUrl.includes(`${opts.containerName}?`)
) {
// Check if the sas url is a container url
containerClient = new ContainerClient(`${opts.sasUrl}`);
return containerClient;
}
Expand Down
1 change: 1 addition & 0 deletions test/drivers/azure-storage-blob.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe.skip("drivers: azure-storage-blob", () => {
const storage = createStorage({
driver: driver({
sasUrl,
containerName: "unstorage",
}),
});
await storage.getKeys();
Expand Down

0 comments on commit 85e81ae

Please sign in to comment.