Skip to content

Commit

Permalink
fix(proxy): Support HTTP_PROXY and HTTPS_PROXY environment variables …
Browse files Browse the repository at this point in the history
…for install and search commands - fixes #81
  • Loading branch information
pilsy committed Feb 18, 2016
1 parent 5b15523 commit 42f5ade
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions lib/install.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
var Promise = require('bluebird')
, path = require('path')
, _ = require('lodash')
, https = require('follow-redirects').https
, async = require('async')
, utils = GLOBAL.lib.utils
, search = GLOBAL.lib.search
, packages = GLOBAL.lib.packages
, util = GLOBAL.lib.util;
var Promise = require('bluebird')
, path = require('path')
, _ = require('lodash')
, https = require('follow-redirects').https
, proxyAgent = require('https-proxy-agent')
, async = require('async')
, utils = GLOBAL.lib.utils
, search = GLOBAL.lib.search
, packages = GLOBAL.lib.packages
, util = GLOBAL.lib.util;

/**
* Launches the installation process
Expand Down Expand Up @@ -173,6 +174,12 @@ exports.run = function(args) {
* @public
*/
exports.getJSON = function(options) {
// Handle HTTP_PROXY and HTTPS_PROXY environment variables
var proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || null;
if (proxy !== null) {
options.agent = new proxyAgent(proxy);
}

return new Promise(function(resolve) {
var req = https.request(options, function(res) {
res.setEncoding('utf-8');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "cleverstack-cli",
"description" : "Command line interface for CleverStack",
"version" : "1.2.9",
"version" : "1.2.10",
"license" : "MIT",
"author": {
"name" : "CleverStack",
Expand Down

0 comments on commit 42f5ade

Please sign in to comment.