MCPcopy
hub / github.com/Unitech/pm2 / _handleAttributeUpdate

Method _handleAttributeUpdate

lib/API.js:1587–1638  ·  view source on GitHub ↗

* Converts CamelCase Commander.js arguments * to Underscore * (nodeArgs -> node_args)

(opts)

Source from the content-addressed store, hash-verified

1585 * (nodeArgs -> node_args)
1586 */
1587 _handleAttributeUpdate (opts) {
1588 var conf = Config.filterOptions(opts);
1589 var that = this;
1590
1591 if (typeof(conf.name) != 'string')
1592 delete conf.name;
1593
1594 var argsIndex = 0;
1595 if (opts.rawArgs && (argsIndex = opts.rawArgs.indexOf('--')) >= 0) {
1596 conf.args = opts.rawArgs.slice(argsIndex + 1);
1597 }
1598
1599 var appConf = Common.verifyConfs(conf)[0];
1600
1601 if (appConf instanceof Error) {
1602 Common.printError('Error while transforming CamelCase args to underscore');
1603 return appConf;
1604 }
1605
1606 if (argsIndex == -1)
1607 delete appConf.args;
1608 if (appConf.name == 'undefined')
1609 delete appConf.name;
1610
1611 delete appConf.exec_mode;
1612
1613 if (Array.isArray(appConf.watch) && appConf.watch.length === 0) {
1614 if (!~opts.rawArgs.indexOf('--watch'))
1615 delete appConf.watch
1616 }
1617
1618 // Options set via environment variables
1619 if (process.env.PM2_DEEP_MONITORING)
1620 appConf.deep_monitoring = true;
1621
1622 // Force deletion of defaults values set by commander
1623 // to avoid overriding specified configuration by user
1624 if (appConf.treekill === true)
1625 delete appConf.treekill;
1626 if (appConf.pmx === true)
1627 delete appConf.pmx;
1628 if (appConf.vizion === true)
1629 delete appConf.vizion;
1630 if (appConf.automation === true)
1631 delete appConf.automation;
1632 if (appConf.autostart === true)
1633 delete appConf.autostart;
1634 if (appConf.autorestart === true)
1635 delete appConf.autorestart;
1636
1637 return appConf;
1638 }
1639
1640 getProcessIdByName (name, cb) {
1641 var that = this;

Callers 2

_operateMethod · 0.80
API.jsFile · 0.80

Calls 2

indexOfMethod · 0.80
sliceMethod · 0.80

Tested by

no test coverage detected