Reputation: 1287
I'd like to change the start script in package.json depending on the environment i'm in:
e.g, i'd like this in development:
"scripts": {
"start": "node app.js"
},
...and this in production:
"scripts": {
"start": "forever -a start ./server.js"
},
Is it possible for package.json to read environment variables? Then I could just throw that string into one of those...
Thanks!
Upvotes: 0
Views: 388
Reputation: 2112
What about using an environment variable ?
Something like:
"scripts": {
"start": "if [ -z "$ENV_PROD" ]; then forever -a start ./server.js; else node app.js; fi"
},
Upvotes: 1