Commit 183de997 by Oleksandr Barabash

CosmosClient init changed to client_id

parent 92062af7
...@@ -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, CosmosDBConfig.KEY) COSMOS_CLIENT = CosmosClient(CosmosDBConfig.HOST, AppConfig.CLIENT_ID)
...@@ -12,7 +12,6 @@ from botbuilder.core import TurnContext ...@@ -12,7 +12,6 @@ from botbuilder.core import TurnContext
from botbuilder.schema import ChannelAccount from botbuilder.schema import ChannelAccount
from marshmallow import EXCLUDE from marshmallow import EXCLUDE
from config import AppConfig
from entities.json.acknowledge import Acknowledge from entities.json.acknowledge import Acknowledge
from entities.json.acknowledge_schema import AcknowledgeSchema from entities.json.acknowledge_schema import AcknowledgeSchema
from entities.json.camel_case_mixin import timestamp_factory from entities.json.camel_case_mixin import timestamp_factory
...@@ -49,11 +48,9 @@ class ItemNotFound(CosmosClientException): ...@@ -49,11 +48,9 @@ class ItemNotFound(CosmosClientException):
class CosmosClient: class CosmosClient:
""" Cosmos Client class """ """ Cosmos Client class """
def __init__(self, host: str, master_key: str): def __init__(self, host: str, client_id: str):
self.executor = futures.ThreadPoolExecutor() self.executor = futures.ThreadPoolExecutor()
mgmt_credentials = ManagedIdentityCredential( mgmt_credentials = ManagedIdentityCredential(client_id=client_id)
client_id=AppConfig.CLIENT_ID
)
self.client = cosmos_client.CosmosClient(host, mgmt_credentials) self.client = cosmos_client.CosmosClient(host, mgmt_credentials)
# self.client = cosmos_client.CosmosClient(host, # self.client = cosmos_client.CosmosClient(host,
# dict(masterKey=master_key)) # dict(masterKey=master_key))
......
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