np-maintain / global-tunnel

Global HTTP & HTTPS tunelling agent - hard fork of https://github.com/SalesforceEng/global-tunnel
BSD 3-Clause "New" or "Revised" License
118 stars 20 forks source link

Do not manipulate env variables #40

Closed gajus closed 5 years ago

gajus commented 5 years ago
export HTTP_PROXY=http://proxy-gateway
node -e "const globalTunnel = require('global-tunnel-ng'); console.log('a', process.env.HTTP_PROXY); globalTunnel.initialize(); console.log('b', process.env.HTTP_PROXY);"
a http://proxy-gateway
b undefined

b should be equal to a.

MarcoScabbiolo commented 5 years ago

See https://github.com/np-maintain/global-tunnel/blob/51413dcf0534252b5049ec213105c7063ccc6367/index.js#L116 . This would be a breaking change. This is intentionally done to prevent double proxy handling by other modules that also check the environment variables.

The actual environment variable is not manipulated, only Node's environment variables are

gajus commented 5 years ago

The actual environment variable is not manipulated, only Node's environment variables are

Your module should not try to look after what other modules are doing. Thats their responsibility.

This behaviour prevents solution-agnostic detection of the HTTP proxy presence.

MarcoScabbiolo commented 5 years ago

This module is being maintained as it is was conceived by the initial developers, we will not make breaking changes.

Your module should not try to look after what other modules are doing. Thats their responsibility.

It is the actual purpose of this module, to add proxy support cross-modules, even if those modules do not support it themselves.

MarcoScabbiolo commented 5 years ago

Hey @gajus , I've told the yeoman community about your package, here is the gitter channel: Join the chat: https://gitter.im/yeoman/yeoman . I implemented global-tunnel there a while ago and they are considering migrating to global-agent.