Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Fixes #4170

Description

This PR makes
pm config list display proxy-related environment variables when they are set.

Changes

  • Modified lib/commands/config.js to display HTTP_PROXY, HTTPS_PROXY, NO_PROXY and their lowercase variants when set
  • Added test case in est/lib/commands/config.js to verify the new behavior
  • Environment variables appear in a new ; environment-related config section

Motivation

As reported in #4170,
pm config list was not showing environment variables like HTTP_PROXY, NOPROXY, etc., even though these variables affect how npm runs. This made it difficult for users to see what proxy settings their environment has and could lead to mistakes.

Testing

Manual testing confirms:

  • When proxy environment variables are set, they appear in the output
  • When they are not set, the section doesn't appear
  • Both uppercase and lowercase variants are shown when present

The new test case verifies that environment variables are displayed correctly.

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner December 4, 2025 19:35
@MaxBlack-dev MaxBlack-dev force-pushed the fix/4170-show-proxy-env-vars branch 2 times, most recently from 3341cf4 to f0b2737 Compare December 4, 2025 19:40
const envVars = []

// Show proxy-related environment variables if they're set
const proxyEnvVars = ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'http_proxy', 'https_proxy', 'no_proxy']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This info should not live in the command. If there are variables that can affect config then @npmcli/config should own that list. Even if it's a manual list for now. Ideally that info would be coupled to the actual parsing of those but I don't think we have that kind of situation possible right now, since those are parsed explicitly in our fetching library and not parsed as config in npm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I've moved the list of proxy environment variables to @npmcli/config/lib/definitions/index.js as a new proxyEnv export. This keeps the environment variable list alongside other config-related constants like nerfDarts and shorthands.

The config command now imports and uses proxyEnv from @npmcli/config/lib/definitions instead of maintaining its own hardcoded list.

Fixes npm#4170

pm config list now displays proxy-related environment variables
(HTTP_PROXY, HTTPS_PROXY, NO_PROXY and their lowercase equivalents)
when they are set. This helps users understand what proxy settings
are being used by npm.

The environment variables are shown in a separate '; environment-related config'
section before the system information (node version, npm version, etc.).
@MaxBlack-dev MaxBlack-dev force-pushed the fix/4170-show-proxy-env-vars branch from f0b2737 to 9c29072 Compare December 5, 2025 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] npm config list should show HTTP_PROXY/HTTPS_PROXY/NOPROXY

2 participants