Commit 40aeee4a by xzyfer

Revert removal on npmconf

This reverts commit 5e21f475.

The solution implemented was not equivalent and resulted in issues
for users with proxies.

Fixes #1458
parent d7072186
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"nan": "^2.2.0", "nan": "^2.2.0",
"node-gyp": "^3.3.1", "node-gyp": "^3.3.1",
"npmconf": "^2.1.2",
"sass-graph": "^2.1.1" "sass-graph": "^2.1.1"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
var fs = require('fs'), var fs = require('fs'),
eol = require('os').EOL, eol = require('os').EOL,
mkdir = require('mkdirp'), mkdir = require('mkdirp'),
npmconf = require('npmconf'),
path = require('path'), path = require('path'),
got = require('got'), got = require('got'),
pkg = require('../package.json'), pkg = require('../package.json'),
...@@ -61,17 +62,25 @@ function download(url, dest, cb) { ...@@ -61,17 +62,25 @@ function download(url, dest, cb) {
*/ */
function applyProxy(options, cb) { function applyProxy(options, cb) {
var env = process.env; npmconf.load({}, function (er, conf) {
var proxyUrl;
options.proxy = env.npm_config_https_proxy || if (!er) {
env.npm_config_proxy || proxyUrl = conf.get('https-proxy') ||
env.npm_config_http_proxy || conf.get('proxy') ||
env.HTTPS_PROXY || conf.get('http-proxy');
env.https_proxy || }
env.HTTP_PROXY ||
env.http_proxy; var env = process.env;
cb(options); options.proxy = proxyUrl ||
env.HTTPS_PROXY ||
env.https_proxy ||
env.HTTP_PROXY ||
env.http_proxy;
cb(options);
});
} }
/** /**
...@@ -112,7 +121,7 @@ if (process.env.SKIP_SASS_BINARY_DOWNLOAD_FOR_CI) { ...@@ -112,7 +121,7 @@ if (process.env.SKIP_SASS_BINARY_DOWNLOAD_FOR_CI) {
} }
/** /**
* If binary does not exist, download it * If binary does not exsit, download it
*/ */
checkAndDownloadBinary(); checkAndDownloadBinary();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment