Skip to content

Commit

Permalink
Merge pull request #3788 from Unitech/uid-gen
Browse files Browse the repository at this point in the history
Generate combination of hostname and uid on link
  • Loading branch information
Unitech committed Jul 13, 2018
2 parents 9bc34e5 + 5324c87 commit f70444f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bin/pm2
Expand Up @@ -605,12 +605,16 @@ commander.command('plus [secret] [public] [name]')
infoNode: _opts.infoNode,
discrete: _opts.discrete,
installAll: _opts.installAll,
gen_uid: _opts.gen,
public: pub,
secret: sec,
name: name,
ws: true
}

if (!name)
opts.name = require('os').hostname() + '-' + require('crypto').randomBytes(2).toString('hex')

if (sec == 'link' || sec == 'relink') {
return pm2._pre_interact(null, null, null, opts, function(err, dt) {
pm2.speedList()
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Interaction.js
Expand Up @@ -159,8 +159,7 @@ module.exports = function(CLI) {
}
KMDaemon.launchAndInteract(that._conf, infos, function(err, dt) {
if (err) {
Common.printError(chalk.red('[PM2 agent] ') + err)
Common.printError(chalk.cyan('[PM2 agent] ') + 'Run `$ pm2 plus` to connect')
Common.printError(chalk.cyan('[PM2.IO] ') + 'Run `$ pm2 plus` to connect')
return that.exitCli(cst.ERROR_EXIT);
}
if (!cb) {
Expand Down

0 comments on commit f70444f

Please sign in to comment.