Skip to content

Commit

Permalink
Fixing Issue microsoft#5 : proxy settings not used
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelGrandin committed Jan 22, 2020
1 parent c960152 commit 3eba617
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ async function getAssetFromGithubApi(opts, assetName, downloadFolder) {
'user-agent': 'vscode-ripgrep'
}
};

// Get proxy information from env variables and instantiate a proxy agent into download options
if(process.env.https_proxy || process.env.http_proxy) {
var HttpsProxyAgent = require('https-proxy-agent');
var proxy = process.env.https_proxy || process.env.http_proxy;
var agent = new HttpsProxyAgent(proxy);
downloadOpts.agent = agent
}

if (opts.token) {
downloadOpts.headers.authorization = `token ${opts.token}`;
}
Expand Down
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"author": "Rob Lourens",
"license": "MIT",
"devDependencies": {
"@types/node": "^10.12.0"
"@types/node": "^10.12.0",
"https-proxy-agent": "^4.0.0"
}
}

0 comments on commit 3eba617

Please sign in to comment.