|
|
@ -20,25 +20,23 @@ access.once('active', async () => { |
|
|
|
/* webpackMode: "eager" */ './middlewares' |
|
|
|
/* webpackMode: "eager" */ './middlewares' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
(async () => { |
|
|
|
stdout(`Starting main process with ownership ${getuid()}:${getgid()}`); |
|
|
|
stdout(`Starting main process with ownership ${getuid()}:${getgid()}`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const server = (await app).listen(PORT, () => { |
|
|
|
const server = (await app).listen(PORT, () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
// Group must be set before user to avoid permission error.
|
|
|
|
// Group must be set before user to avoid permission error.
|
|
|
|
setgid(PGID); |
|
|
|
setgid(PGID); |
|
|
|
setuid(PUID); |
|
|
|
setuid(PUID); |
|
|
|
|
|
|
|
|
|
|
|
stdout(`Main process ownership changed to ${getuid()}:${getgid()}.`); |
|
|
|
stdout(`Main process ownership changed to ${getuid()}:${getgid()}.`); |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
stderr(`Failed to change main process ownership; CAUSE: ${error}`); |
|
|
|
stderr(`Failed to change main process ownership; CAUSE: ${error}`); |
|
|
|
|
|
|
|
|
|
|
|
process.exit(ECODE_DROP_PRIVILEGES); |
|
|
|
process.exit(ECODE_DROP_PRIVILEGES); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
stdout(`Listening on localhost:${PORT}.`); |
|
|
|
stdout(`Listening on localhost:${PORT}.`); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
server.on('upgrade', proxyServerVncUpgrade); |
|
|
|
server.on('upgrade', proxyServerVncUpgrade); |
|
|
|
})(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|