Load local.env.js in Angular-fullstack Load local.env.js in Angular-fullstack express express

Load local.env.js in Angular-fullstack


Did you try setting actual environment variables on the shell you are executing grunt from?

Example using your variable name, place the following line in .bash_profile (if you run bash):

export MY_ENV_VAR="string value"

The native nodejs process picks up these environment variables and passes them to grunt.


I ran into this same problem. My issue was with grunt. I stopped the grunt serve process, made the change, and then ran grunt serve in the console. Grunt did not update the assignment of the environmental variable.

Here is an example of using the variable.

module.exports = {  // MongoDB connection options  mongo: {    uri: process.env.DB_DEV_URI  },  seedDB: true};//DB_DEV_URI is assigned in the local.env.js file