Ability to set CosmosClientOptions - helpful with local Docker Emulator usage
See original GitHub issueIs your feature request related to a problem? Please describe. When attempting to use the repository in a containerised application the following error occurs: “System.InvalidOperationException: Cannot create Collection Information for Drivers in database drivers with lease leases in database drivers : The SSL connection could not be established, see inner exception. —> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.”
The lack of configurability is preventing me from using this really useful repository as part of our microservice solution
Describe the solution you’d like Looking at this link it seems we can override certificate config, so the ability pass these options through (or the repo’s own version of) would be a suggestion? https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21#disable-ssl-validation
CosmosClientOptions cosmosClientOptions = new CosmosClientOptions()
{
HttpClientFactory = () =>
{
HttpMessageHandler httpMessageHandler = new HttpClientHandler()
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
return new HttpClient(httpMessageHandler);
},
ConnectionMode = ConnectionMode.Gateway
};
CosmosClient client = new CosmosClient(endpoint, authKey, cosmosClientOptions);
Additional context Unless there is currently a way of achieving local, containerised development already within the project I’m unaware of, I think solving this problem would open up the repository to another level of software.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (2 by maintainers)
@mumby0168 @IEvangelist this is what I ended up with after being able to override the cosmos client options as discussed.
Likewise, good luck with the project.