|
1 | | -var Promise = require('bluebird') |
2 | | - , path = require('path') |
3 | | - , _ = require('lodash') |
4 | | - , https = require('follow-redirects').https |
5 | | - , async = require('async') |
6 | | - , utils = GLOBAL.lib.utils |
7 | | - , search = GLOBAL.lib.search |
8 | | - , packages = GLOBAL.lib.packages |
9 | | - , util = GLOBAL.lib.util; |
| 1 | +var Promise = require('bluebird') |
| 2 | + , path = require('path') |
| 3 | + , _ = require('lodash') |
| 4 | + , https = require('follow-redirects').https |
| 5 | + , proxyAgent = require('https-proxy-agent') |
| 6 | + , async = require('async') |
| 7 | + , utils = GLOBAL.lib.utils |
| 8 | + , search = GLOBAL.lib.search |
| 9 | + , packages = GLOBAL.lib.packages |
| 10 | + , util = GLOBAL.lib.util; |
10 | 11 |
|
11 | 12 | /** |
12 | 13 | * Launches the installation process |
@@ -173,6 +174,12 @@ exports.run = function(args) { |
173 | 174 | * @public |
174 | 175 | */ |
175 | 176 | exports.getJSON = function(options) { |
| 177 | + // Handle HTTP_PROXY and HTTPS_PROXY environment variables |
| 178 | + var proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || null; |
| 179 | + if (proxy !== null) { |
| 180 | + options.agent = new proxyAgent(proxy); |
| 181 | + } |
| 182 | + |
176 | 183 | return new Promise(function(resolve) { |
177 | 184 | var req = https.request(options, function(res) { |
178 | 185 | res.setEncoding('utf-8'); |
|
0 commit comments