Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm package for NODE_TLS_REJECT_UNAUTHORIZED environment variable

Tags:

node.js

Hello for nodejs programming, I am using visual studio community 2015 with node js tools. That environment does not have NODE_TLS_REJECT_UNAUTHORIZED process.env variable. What is the package to install NODE_TLS_REJECT_UNAUTHORIZED variable?

like image 851
Mat Avatar asked Sep 01 '26 16:09

Mat


1 Answers

There is no package for environment variables, you just set them or not in your shell environment. For Windows if you wanted to set it you'd first do:

set NODE_TLS_REJECT_UNAUTHORIZED=1
node foo.js

For *nix you could do something like:

NODE_TLS_REJECT_UNAUTHORIZED=1 node foo.js

or to make it persistent for the duration of the shell session:

export NODE_TLS_REJECT_UNAUTHORIZED=1
node foo.js

However you really should avoid the rejectUnauthorized setting and if applicable, instead supply the self-signed CA when making https requests.

like image 140
mscdex Avatar answered Sep 03 '26 06:09

mscdex



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!