Skip to content

Commit

Permalink
now default right on sock file are 755 + PM2_SOCKET_USER + PM2_SOCKET…
Browse files Browse the repository at this point in the history
…_GROUP to override sockets rights
  • Loading branch information
Unitech committed Dec 21, 2017
1 parent 6b26e63 commit 81333db
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/Daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ Daemon.prototype.innerStart = function(cb) {
this.pub_socket = this.pub.bind(this.pub_socket_file);

this.pub_socket.once('bind', function() {
fs.chmod(that.pub_socket_file, '775', function(e) {
if (e) console.error(e);

try {
if (process.env.PM2_SOCKET_USER && process.env.PM2_SOCKET_GROUP)
fs.chown(that.pub_socket_file,
parseInt(process.env.PM2_SOCKET_USER),
parseInt(process.env.PM2_SOCKET_GROUP), function(e) {
if (e) console.error(e);
});
} catch(e) {
console.error(e);
}
});

that.pub_socket_ready = true;
that.sendReady(cb);
});
Expand All @@ -113,6 +128,22 @@ Daemon.prototype.innerStart = function(cb) {
this.rpc_socket = this.rep.bind(this.rpc_socket_file);

this.rpc_socket.once('bind', function() {
fs.chmod(that.rpc_socket_file, '775', function(e) {
if (e) console.error(e);

try {
if (process.env.PM2_SOCKET_USER && process.env.PM2_SOCKET_GROUP)
fs.chown(that.rpc_socket_file,
parseInt(process.env.PM2_SOCKET_USER),
parseInt(process.env.PM2_SOCKET_GROUP), function(e) {
if (e) console.error(e);
});
} catch(e) {
console.error(e);
}
});


that.rpc_socket_ready = true;
that.sendReady(cb);
});
Expand Down

0 comments on commit 81333db

Please sign in to comment.