Azure / azure-cosmosdb-node

We recently announced deprecation of JS v1 SDK and this repo. Starting September 2020 Microsoft will not provide support for this library. Existing applications using library will continue to work as-is. We strongly recommend upgrading to @azure/cosmos library.
https://github.com/Azure/azure-sdk-for-js
MIT License
141 stars 107 forks source link

Configure proxy with env variable #237

Closed abalbin closed 5 years ago

abalbin commented 6 years ago

I've been working with this library for connecting to a cosmos db from an azure chatbot and had trouble connecting to that DB behind a corporate proxy.

With this fix, the proxy can be configured previously with an ENV variable like these:

process.env.https_proxy = "http://proxy:80"
process.env.http_proxy = "http://proxy:80"
srinathnarayanan commented 6 years ago

Hi @abalbin, can't you just set connectionPolicy.ProxyUrl that you pass on to the documentClient ?

abalbin commented 6 years ago

Hey @srinathnarayanan, the thing is that we are using the DocumentDbClient from botbuilder-azure and there documentClient is instantiated like this:

var documentdb_1 = require("documentdb");
var client = new documentdb_1.DocumentClient(this.options.host, { masterKey: this.options.masterKey });

I think it's easier if you just set the proxy as an ENV variable once, so it also serves to specify the proxy for libraries like request.js that are needed for other components of a chatbot like LUIS or QnA Maker.

christopheranderson commented 6 years ago

I'm against this since it could mess with other clients that might not know that environment is set. This should be a requested change to bot-builder to support proxy for their backend.