-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Supporting ecosystem.config.js. This allows to use javascript and module.exp… #2451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…orts in config file to avoid copy-paste and etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests
Tests are failing
@@ -199,6 +199,8 @@ Common.isConfigFile = function(filename) { | |||
return 'json'; | |||
if (filename.indexOf('.yml') > -1 || filename.indexOf('.yaml') > -1) | |||
return 'yaml'; | |||
if (filename.indexOf('.js') != -1) | |||
return 'js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
@@ -230,7 +232,11 @@ Common.parseConfig = function(confObj, filename) { | |||
else if (filename.indexOf('.yml') > -1 || | |||
filename.indexOf('.yaml') > -1) { | |||
return yamljs.parse(confObj.toString()); | |||
}else if (filename.indexOf('.js') > -1){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space after {
@@ -230,7 +232,11 @@ Common.parseConfig = function(confObj, filename) { | |||
else if (filename.indexOf('.yml') > -1 || | |||
filename.indexOf('.yaml') > -1) { | |||
return yamljs.parse(confObj.toString()); | |||
}else if (filename.indexOf('.js') > -1){ | |||
delete require.cache[require.resolve(filename)]; | |||
return require(filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
…sh configuration from the script. Make tests
@@ -199,6 +199,8 @@ Common.isConfigFile = function(filename) { | |||
return 'json'; | |||
if (filename.indexOf('.yml') > -1 || filename.indexOf('.yaml') > -1) | |||
return 'yaml'; | |||
if (filename.indexOf('.config.js') != -1) | |||
return 'js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need indent here.
Seems good to me, waiting for test. |
nice! we should update http://pm2.keymetrics.io/docs/usage/application-declaration/ |
landed in main + doc updated [email protected] (main): $ npm install pm2 -g
$ pm2 update |
As I understand from the code the filename has to have ".config.js" as extension so something like "app.js" does not work. Is there a reason to force ".config" part? I have been debugging my app last couple of hours to find this out. At least it would be nice to mention this in the documentation that .config part is necessary. |
@doganyazar Because pm2 need to know when your entry file is a ecosystem file or just a javascript file. The |
Thanks for the answer @vmarchaud. The confusing part for me was that documentation does not say .config part is a must but yeah maybe it is trivial for the others :) |
@doganyazar Its written in the documentation that i linked : |
My bad! Sorry for wasting your time. |
@doganyazar No problem :) |
…orts in config file to avoid copy-paste and etc