Set environment variable before npm start
package.json
app.js
console.log(process.env.CONFIG) //abc
package.json
...
"scripts": {
"start": "node app.js",
"test": "CONFIG=abc mocha --reporter spec"
},
...
app.js
console.log(process.env.CONFIG) //abc
沒有留言:
張貼留言