Skip to content

Commit

Permalink
always remove the proxy env vars even if the config is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
emirotin committed Apr 25, 2017
1 parent 95a3f8c commit 00bac91
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,23 @@ globalTunnel.initialize = function(conf) {
return;
}

// This has an effect of also removing the proxy config
// from the global env to prevent other modules (like requst) doing
// double handling
var envVarProxy = findEnvVarProxy();

if (conf && typeof conf === 'string') {
// passed string - parse it as a URL
conf = tryParse(conf);
} else if (conf) {
// passed object - take it but clone for future mutations
conf = clone(conf)
} else {
} else if (envVarProxy) {
// nothing passed - parse from the env
var envVarProxy = findEnvVarProxy();

if (!envVarProxy) {
globalTunnel.isProxying = false;
return;
} else {
conf = tryParse(envVarProxy);
}
conf = tryParse(envVarProxy);
} else {
globalTunnel.isProxying = false;
return;
}

if (!conf.host) {
Expand Down

0 comments on commit 00bac91

Please sign in to comment.