Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access nodejs config

npm config set proxy http://proxy.company.com:8080

Is how I set a proxy for my node installation. How can I access this configured proxy from inside my nodejs application?

like image 277
Coxer Avatar asked Oct 19 '25 01:10

Coxer


1 Answers

You could call npm config list as a subprocess which will return all configurations, similar to this one:

; cli configs
registry = "https://registry.npmjs.org/"

; userconfig /home/username/.npmrc
email = "[email protected]"
username = "name"

; node bin location = /home/name/apps/nvm/v0.10.7/bin/node
; cwd = /home/name/subfolder
; HOME = /home/name
; 'npm config ls -l' to show all defaults.

Use npm config ls -l to get a full list, which includes the default config settings.

like image 127
TheHippo Avatar answered Oct 21 '25 14:10

TheHippo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!