I have following json conf file:
{
"apps": [
{
"name": "dev-web-app",
"script": "index.js",
"watch": [
"server",
"shared",
"srv_lib"
],
"merge_logs": true,
"env": {
"NODE_ENV": "development",
"NODE_PATH": ""
},
"exec_mode": "fork_mode"
}
}
Then I run following command
pm2-dev start config/pm2/_development.json
I expect pm2 restarts process when files changed in following dir:
"server",
"shared",
"srv_lib"
Process is restarted when a file is changed in all project folder
Problem is here: https://github.com/Unitech/pm2/blob/development/lib/API.js#L851-L861
command options override app options insecurely
I can fix this issue if I make this change
appConf.forEach(function(app) {
if (opts.only && opts.only != app.name)
return false;
if (opts.watch && opts.watch === true && !app.watch)
app.watch = true;
if (opts.ignore_watch && !app.ignore_watch) // same issue with ignore_watch
app.ignore_watch = opts.ignore_watch;
if (opts.instances && typeof(opts.instances) === 'number')
app.instances = opts.instances;
apps_name.push(app.name);
});
OS : win7
node.js : 6.5.0
PM2 : 2.0.7
LGTM feel free to send a PR
@amelon I've the same problem. Can you create a PR, please?
I think it's because pm2-dev is forcing watch to true: https://github.com/Unitech/pm2/blob/master/lib/DevCli.js#L65
@danielbayerlein: hard to figure out what are the rights expectations (see @soyuka comment).
For instance I switched back to nodemon on dev because I'm facing to many issues with pm2-dev
you can try to use pm2 instead of pm2-dev with your own configuration
I think we can close the issue 馃槂
landed in dev