Skip to content

Commit

Permalink
[azure] set account_(name|key) from connection_string if not provided (
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh-reddy03 authored Feb 28, 2023
1 parent b4f6fde commit 90e2e78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions storages/backends/azure_storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mimetypes
import re
from datetime import datetime
from datetime import timedelta
from tempfile import SpooledTemporaryFile
Expand Down Expand Up @@ -128,6 +129,9 @@ def __init__(self, **settings):
self._custom_client = None
self._user_delegation_key = None
self._user_delegation_key_expiry = datetime.utcnow()
if self.connection_string and (not self.account_name or not self.account_key):
self.account_name = re.search(r'AccountName=(\w+);', self.connection_string)[1]
self.account_key = re.search(r'AccountKey=(.*);', self.connection_string)[1]

def get_default_settings(self):
return {
Expand Down

0 comments on commit 90e2e78

Please sign in to comment.