I'm new enough to node.js, and there is a program that I have to set environment variables to run (using noble , my bash command: sudo NOBLE_HCI_DEVICE_ID=x node program.js to tell my code that uses the Bluetooth adapter HCI device )
The reason for this is that I have several modules, each of which needs its own Bluetooth adapter, and I want to indicate in my code which adapter each module should use.
I found many articles telling me how to consume environment variables in my code and set them using the command line (process.env.VARIABLE_NAME), but didn’t tell me how to set them in node.js,
Is it possible to set environment variables in my node.js code?
thanks
source share