One way of setting environment variables is in your settings.js
file.
The following will set the env var MY_ENV_VAR
:
process.env.MY_ENV_VAR = "Hello World";
You can add lines like that to the top of your settings file.
The other option is to set them completely outside of Node-RED in shell you are running Node-RED in. How you do that will depend on your OS and how you are running Node-RED.