proxy.js 1.0 KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const debug = require("debug");
  4. const utils_1 = require("./utils");
  5. const d = debug('@electron/get:proxy');
  6. /**
  7. * Initializes a third-party proxy module for HTTP(S) requests.
  8. */
  9. function initializeProxy() {
  10. try {
  11. // See: https://github.com/electron/get/pull/214#discussion_r798845713
  12. const env = utils_1.getEnv('GLOBAL_AGENT_');
  13. utils_1.setEnv('GLOBAL_AGENT_HTTP_PROXY', env('HTTP_PROXY'));
  14. utils_1.setEnv('GLOBAL_AGENT_HTTPS_PROXY', env('HTTPS_PROXY'));
  15. utils_1.setEnv('GLOBAL_AGENT_NO_PROXY', env('NO_PROXY'));
  16. /**
  17. * TODO: replace global-agent with a hpagent. @BlackHole1
  18. * https://github.com/sindresorhus/got/blob/HEAD/documentation/tips.md#proxying
  19. */
  20. require('global-agent').bootstrap();
  21. }
  22. catch (e) {
  23. d('Could not load either proxy modules, built-in proxy support not available:', e);
  24. }
  25. }
  26. exports.initializeProxy = initializeProxy;
  27. //# sourceMappingURL=proxy.js.map