Skip to content

Conversation

@c-w
Copy link
Contributor

@c-w c-w commented May 12, 2020

Currently storage-azure hard-codes the endpoint of the Azure Storage
account to blob.core.windows.net which means that the library can't be
used in regions such as Azure China or Azure Government, with Azure
Stack, or with the Storage Emulator for testing.

This change enables customizing the storage endpoint to remove this
limitation. With this change, we can for example use storage-azure to
talk to the Azurite storage emulator [1] like so:

const az = new AzureBlobStorage({
  container: process.env.CONTAINER,
  accountName: 'devstoreaccount1',
  accountKey: 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==',
  endpoint: 'http://localhost:10000'
})
await az.writeFile('azure-write/test.txt', 'using azure storage emulator')

[1] https://github.com/Azure/Azurite

Currently storage-azure hard-codes the endpoint of the Azure Storage
account to `blob.core.windows.net` which means that the library can't be
used in regions such as Azure China or Azure Government, with Azure
Stack, or with the Storage Emulator for testing.

This change enables customizing the storage endpoint to remove this
limitation. With this change, we can for example use storage-azure to
talk to the Azurite storage emulator [1] like so:

```ts
const az = new AzureBlobStorage({
  container: process.env.CONTAINER,
  accountName: 'devstoreaccount1',
  accountKey: 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==',
  endpoint: 'http://localhost:10000'
})
await az.writeFile('azure-write/test.txt', 'using azure storage emulator')
```

[1] https://github.com/Azure/Azurite
@jsbroks jsbroks merged commit 53bd8b4 into datatorch:master May 12, 2020
@jsbroks
Copy link
Member

jsbroks commented May 12, 2020

Thanks for your contribution!

Should also add support like this to AWS

@c-w c-w deleted the azure-storage-endpoint branch May 12, 2020 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants