Skip to content

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

Merged
merged 4 commits into from
Oct 24, 2016

Conversation

igorushko
Copy link

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #2433
License MIT
Doc PR https://github.com/pm2-hive/pm2-hive.github.io/pulls

…orts in config file to avoid copy-paste and etc

…orts in config file to avoid copy-paste and etc
Copy link
Collaborator

@soyuka soyuka left a 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';
Copy link
Collaborator

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){
Copy link
Collaborator

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);
Copy link
Collaborator

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
@igorushko igorushko changed the title Supporting ecosystem.js. This allows to use javascript and module.exp… Supporting ecosystem.config.js. This allows to use javascript and module.exp… Oct 16, 2016
@@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need indent here.

@vmarchaud
Copy link
Contributor

Seems good to me, waiting for test.

@Unitech Unitech merged commit ec014b0 into Unitech:development Oct 24, 2016
@Unitech
Copy link
Owner

Unitech commented Oct 24, 2016

@Unitech
Copy link
Owner

Unitech commented Nov 7, 2016

landed in main + doc updated

[email protected] (main):

$ npm install pm2 -g
$ pm2 update

@doganyazar
Copy link

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.

@vmarchaud
Copy link
Contributor

@doganyazar Because pm2 need to know when your entry file is a ecosystem file or just a javascript file. The .config.js part is specified in the documentation right there

@doganyazar
Copy link

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 :)

@vmarchaud
Copy link
Contributor

vmarchaud commented Mar 27, 2017

@doganyazar Its written in the documentation that i linked : Note that using a Javascript configuration file requires to suffix the file with .config.js

@doganyazar
Copy link

My bad! Sorry for wasting your time.

@vmarchaud
Copy link
Contributor

@doganyazar No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants