Here's a practical way to do this.
First of all, you have ti understand that you have to execute shell file to pass data to Node's process objects, i.e, Environment variables.
Ok, so let's create a shell file where you will store all the env variables. Like this,
#!/usr/bin/env bash
export NODE_ENV='development'
export ENVIRONMENT='development'
export PORT='4000'
export TEST_PORT='4040'
# MongoDB
export MONGO_URL='mongodb://localhost:27017/test'
Let's name this file env.sh.
Now let's say your node app is testApp and you run your app by running npm start, so this is what you need to do now:
testApp~$ . ./env.sh && npm start
What above command is doing, it's running your config shell file and then your node app, so in your node app you can access these fields:
process.env.PORT
process.env.TEST_PORT // and so on, basically whatever you have in env.sh file
I hope everything's clear. Let me know in case of any clarification.