Added better support for NODE_ENV

-The different methods of starting the explorer now set NODE_ENV to "development" or "production" depending on which options were chosen
-pm2 is now loaded from within the prestart script and will reload the config instead of starting if it was previously loaded which allows changing the NODE_ENV value if necessary

NOTE: if running via pm2 or forever when updating the explorer with this change, it is necessary to manually stop the explorer with `npm run stop-pm2` or `npm run stop-forever` and then start again after the code has been updated to allow NODE_ENV to be set to "production". Without doing this, the explorer will still be run in "development" mode until pm2 or forever is fully stopped and restarted.
This commit is contained in:
Joe Uhren
2023-05-27 21:45:03 -06:00
parent cb6c95c472
commit de0da04e7b
3 changed files with 59 additions and 38 deletions
+3 -3
View File
@@ -6,11 +6,11 @@
"start": "node --stack-size=10000 ./bin/cluster",
"stop": "node ./scripts/stop_explorer.js",
"start-instance": "npm run prestart && node --stack-size=10000 ./bin/cluster 1",
"start-forever": "npm run prestart \"forever\"",
"start-forever": "npm run prestart \"forever production\"",
"stop-forever": "forever stop \"explorer\"",
"reload-forever": "forever restart \"explorer\"",
"start-pm2": "npm run prestart \"pm2\" && pm2 start ./bin/instance -i 0 -n explorer -p \"./tmp/pm2.pid\" --node-args=\"--stack-size=10000\"",
"start-pm2-debug": "npm run prestart \"pm2\" && pm2 start ./bin/instance -i 0 -n explorer -p \"./tmp/pm2.pid\" --node-args=\"--stack-size=10000\" && pm2 logs",
"start-pm2": "npm run prestart \"pm2 production\"",
"start-pm2-debug": "npm run prestart \"pm2 development\" && pm2 logs",
"stop-pm2": "pm2 stop explorer",
"reload-pm2": "pm2 reload explorer",
"test": "node ./node_modules/jasmine/bin/jasmine.js test/*Spec.js",