cosmosdb-server icon indicating copy to clipboard operation
cosmosdb-server copied to clipboard

Feature request: add externalized configuration for certificates and logging

Open dsschneidermann opened this issue 4 years ago • 0 comments

Hi guys. Thanks for this repo. I'm now using it succesfully to mock CosmosDb for the Azure IoT Device Simulation solution (https://github.com/Azure/device-simulation-dotnet/tree/DS-2.0.6).

I've set it up with docker-compose and have generated a self-signed CA certificate for the assigned hostname, and added it to the device simulation container, so when it connects using the Azure CSharp SDK, all SSL checks out and it just works(tm), aside from a few quirks that I had to look at (#46 and #48).

In doing this, I found a need for two main things:

  • Adding optional paths for an external cert and cert key to cosmosdb-server
  • Adding more default logging for the requests and responses

My solution was to take the index.js (after compilation) and provide a replacement instead, packaging it with the docker image.

I'm not a node wiz, by far, so my logging additions have just been hacked together from what I could find from examples online, here it is: https://gist.github.com/dsschneidermann/a9314afee146feaffbeada42829e2e73

I can also provide the Dockerfile, docker-compose.yml etc if anyone is interested.

Edit: I forgot, I'm also overriding the read-meta.js file in order to set the self-aware "databaseAccountEndpoint" address and switch the default consistency level to "Strong", as it's needed for my case. Gist: https://gist.github.com/dsschneidermann/952f9160d5ce08aa69908b0862dcb5c6

dsschneidermann avatar Oct 31 '20 05:10 dsschneidermann