summaryrefslogtreecommitdiff
path: root/kombu
diff options
context:
space:
mode:
authorDavid Bossanyi <davebossanyi@gmail.com>2022-10-16 15:43:15 +0100
committerGitHub <noreply@github.com>2022-10-16 20:43:15 +0600
commit22b559684f62417d47a0370e5f8f65b9278a9903 (patch)
tree8a41bf32a34a25c6938d2512c4dc4d41cc30907c /kombu
parentc7615fc537430f897febfffd0dbe20b15e6c2b2a (diff)
downloadkombu-22b559684f62417d47a0370e5f8f65b9278a9903.tar.gz
Allow azurestoragequeues transport to be used with Azurite emulator in docker-compose (#1611)
* Parse credential as a dict when using Azurite emulator This more flexible credential allows the use of Azurite for integration testing in local docker-compose configurations. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix some lint errors Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'kombu')
-rw-r--r--kombu/transport/azurestoragequeues.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/kombu/transport/azurestoragequeues.py b/kombu/transport/azurestoragequeues.py
index 0e3837a8..ab590019 100644
--- a/kombu/transport/azurestoragequeues.py
+++ b/kombu/transport/azurestoragequeues.py
@@ -178,7 +178,7 @@ class Transport(virtual.Transport):
can_parse_url = True
@staticmethod
- def parse_uri(uri: str) -> tuple[str, str]:
+ def parse_uri(uri: str) -> tuple[str | dict, str]:
# URL like:
# azurestoragequeues://STORAGE_ACCOUNT_ACCESS_KEY@STORAGE_ACCOUNT_URL
# azurestoragequeues://SAS_TOKEN@STORAGE_ACCOUNT_URL
@@ -192,6 +192,13 @@ class Transport(virtual.Transport):
# > 'some/key', 'url'
credential, url = uri.rsplit('@', 1)
+ # parse credential as a dict if Azurite is being used
+ if "devstoreaccount1" in url and ".core.windows.net" not in url:
+ credential = {
+ "account_name": "devstoreaccount1",
+ "account_key": credential,
+ }
+
# Validate parameters
assert all([credential, url])
except Exception: