Commit b71de28b by Oleksandr Barabash

cosmos changed back to the key

parent 5d683d80
...@@ -38,7 +38,7 @@ class CosmosDBConfig: ...@@ -38,7 +38,7 @@ class CosmosDBConfig:
""" Cosmos Databases """ """ Cosmos Databases """
HOST = os.environ.get('ACCOUNT_HOST', HOST = os.environ.get('ACCOUNT_HOST',
'https://nancycosomsdb.documents.azure.com:443/') 'https://nancycosomsdb.documents.azure.com:443/')
KEY = os.environ.get('ACCOUNT_KEY', KEY = os.environ.get('COSMOS_KEY',
'fNVRCesO1NAb9MYZNK2rKdAPkY9J4O5ntR8CRuKu6wVGhndiaXch' 'fNVRCesO1NAb9MYZNK2rKdAPkY9J4O5ntR8CRuKu6wVGhndiaXch'
'Q6fKwrTTnTbv4tPM8S74YjZsfcX4uAHgiw==') 'Q6fKwrTTnTbv4tPM8S74YjZsfcX4uAHgiw==')
...@@ -71,4 +71,4 @@ class CosmosDBConfig: ...@@ -71,4 +71,4 @@ class CosmosDBConfig:
PARTITION_KEY = PartitionKey(path="/notificationId") PARTITION_KEY = PartitionKey(path="/notificationId")
COSMOS_CLIENT = CosmosClient(CosmosDBConfig.HOST, AppConfig.CLIENT_ID) COSMOS_CLIENT = CosmosClient(CosmosDBConfig.HOST, CosmosDBConfig.KEY)
...@@ -48,15 +48,15 @@ class ItemNotFound(CosmosClientException): ...@@ -48,15 +48,15 @@ class ItemNotFound(CosmosClientException):
class CosmosClient: class CosmosClient:
""" Cosmos Client class """ """ Cosmos Client class """
def __init__(self, host: str, client_id: str): def __init__(self, host: str, master_key: str):
self.executor = futures.ThreadPoolExecutor() self.executor = futures.ThreadPoolExecutor()
mgmt_credentials = ManagedIdentityCredential(client_id=client_id) # mgmt_credentials = ManagedIdentityCredential(client_id=client_id)
self.client = cosmos_client.CosmosClient( # self.client = cosmos_client.CosmosClient(
host, mgmt_credentials, # host, mgmt_credentials,
consistency_level=documents.ConsistencyLevel.Strong # consistency_level=documents.ConsistencyLevel.Strong
) # )
# self.client = cosmos_client.CosmosClient(host, self.client = cosmos_client.CosmosClient(host,
# dict(masterKey=master_key)) dict(masterKey=master_key))
async def execute_blocking(self, bl, *args): async def execute_blocking(self, bl, *args):
""" Execute blocking code """ """ Execute blocking code """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment