proxy.js 632 B

12345678910111213141516171819202122
  1. /**
  2. * Determine the proxy settings configured by npm
  3. *
  4. * It's possible to configure npm to use a proxy different
  5. * from the system defined proxy. This can be done via the
  6. * `npm config` CLI or the `.npmrc` config file.
  7. *
  8. * If a proxy has been configured in this way we must
  9. * tell request explicitly to use it.
  10. *
  11. * Otherwise we can trust request to the right thing.
  12. *
  13. * @return {String} the proxy configured by npm or an empty string
  14. * @api private
  15. */
  16. module.exports = function() {
  17. return process.env.npm_config_https_proxy ||
  18. process.env.npm_config_proxy ||
  19. process.env.npm_config_http_proxy ||
  20. '';
  21. };