refactor(striker-ui-api): remove unnecessary wrapper in main process starter

main
Tsu-ba-me 9 months ago
parent 1d9057001a
commit 7b3e445ed0
  1. 30
      striker-ui-api/src/index.ts

@ -20,25 +20,23 @@ access.once('active', async () => {
/* 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, () => {
try {
// Group must be set before user to avoid permission error.
setgid(PGID);
setuid(PUID);
const server = (await app).listen(PORT, () => {
try {
// Group must be set before user to avoid permission error.
setgid(PGID);
setuid(PUID);
stdout(`Main process ownership changed to ${getuid()}:${getgid()}.`);
} catch (error) {
stderr(`Failed to change main process ownership; CAUSE: ${error}`);
stdout(`Main process ownership changed to ${getuid()}:${getgid()}.`);
} catch (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);
});

Loading…
Cancel
Save