From a9ea2f120478210b4f8300672e39a9b7b92fc239 Mon Sep 17 00:00:00 2001 From: Rijnhard Hessel Date: Fri, 14 Sep 2018 15:35:29 +0200 Subject: [PATCH 1/4] Add Support for storage Emulator https://docs.microsoft.com/en-gb/azure/storage/common/storage-use-emulator#addressing-resources-in-the-storage-emulator This could help pave the way for using https://github.com/azure/azurite to test. fixed the protocol handling while at it. it still needs to be done for the Tables and Queues, if this is accepted I'll consider making the PR's for those as well. --- lib/pkgcloud/azure/storage/client/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pkgcloud/azure/storage/client/index.js b/lib/pkgcloud/azure/storage/client/index.js index 4a62384ab..011d8f5d6 100644 --- a/lib/pkgcloud/azure/storage/client/index.js +++ b/lib/pkgcloud/azure/storage/client/index.js @@ -57,7 +57,10 @@ Client.prototype._getUrl = function (options) { fragment = urlJoin(fragment, options.path); } + if (this.config.emulator) { + return urlJoin('http://127.0.0.1:10000/devstoreaccount1', fragment); + } - return urlJoin('http://' + this.azureKeys.storageAccount + '.' + this.serversUrl + '/', + return urlJoin(this.protocol + this.azureKeys.storageAccount + '.' + this.serversUrl + '/', fragment); }; From 70b9e8ad4c681972796d0d45eb9913873cd16a66 Mon Sep 17 00:00:00 2001 From: Rijnhard Hessel Date: Fri, 14 Sep 2018 15:41:32 +0200 Subject: [PATCH 2/4] Update azure.md --- docs/providers/azure.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/providers/azure.md b/docs/providers/azure.md index b81650142..81ab3b66b 100644 --- a/docs/providers/azure.md +++ b/docs/providers/azure.md @@ -142,6 +142,7 @@ client.createServer(options, function (err, server) { * `protocol`: specifies the transport protocol for the endpoint. * `rdp.port`: (Optional. Windows servers only). The port to use for RDP on Windows servers. +* `emulator`: (Optional) ignores location & account settings and uses [Azure Storage Emulator hardcoded settings](https://docs.microsoft.com/en-gb/azure/storage/common/storage-use-emulator#addressing-resources-in-the-storage-emulator).
From f90c24ecfaeeb48d6083ad45c80738d08786fd68 Mon Sep 17 00:00:00 2001 From: Rijnhard Hessel Date: Tue, 6 Nov 2018 11:01:28 +0200 Subject: [PATCH 3/4] Changed emulator to be config driven * adds support for virtual/docker environments --- lib/pkgcloud/azure/storage/client/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pkgcloud/azure/storage/client/index.js b/lib/pkgcloud/azure/storage/client/index.js index 011d8f5d6..f0ec7f27a 100644 --- a/lib/pkgcloud/azure/storage/client/index.js +++ b/lib/pkgcloud/azure/storage/client/index.js @@ -58,7 +58,7 @@ Client.prototype._getUrl = function (options) { } if (this.config.emulator) { - return urlJoin('http://127.0.0.1:10000/devstoreaccount1', fragment); + return urlJoin(this.protocol + this.serversUrl, this.azureKeys.storageAccount, fragment); } return urlJoin(this.protocol + this.azureKeys.storageAccount + '.' + this.serversUrl + '/', From 17c6515adba8d094843141355d943154a50945f1 Mon Sep 17 00:00:00 2001 From: Rijnhard Hessel Date: Tue, 6 Nov 2018 11:04:24 +0200 Subject: [PATCH 4/4] Update azure.md * updated emulator setting description --- docs/providers/azure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/providers/azure.md b/docs/providers/azure.md index 81ab3b66b..499360abb 100644 --- a/docs/providers/azure.md +++ b/docs/providers/azure.md @@ -142,7 +142,7 @@ client.createServer(options, function (err, server) { * `protocol`: specifies the transport protocol for the endpoint. * `rdp.port`: (Optional. Windows servers only). The port to use for RDP on Windows servers. -* `emulator`: (Optional) ignores location & account settings and uses [Azure Storage Emulator hardcoded settings](https://docs.microsoft.com/en-gb/azure/storage/common/storage-use-emulator#addressing-resources-in-the-storage-emulator). +* `emulator`: (Optional) enables support for the Azure emulator [Azure Storage Emulator settings](https://docs.microsoft.com/en-gb/azure/storage/common/storage-use-emulator#addressing-resources-in-the-storage-emulator), you still need to configure the credentials to what is expected by the emulator, e.g. account `devstoreaccount1`.