Start server when loaded by the PM2 fork container
This commit is contained in:
+2
-1
@@ -28,6 +28,7 @@ export async function startServer(env = process.env) {
|
||||
return app;
|
||||
}
|
||||
|
||||
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
||||
const entryPath = process.env.pm_exec_path || process.argv[1];
|
||||
if (entryPath && import.meta.url === pathToFileURL(entryPath).href) {
|
||||
startServer().catch(() => { process.stderr.write('Server startup failed; check configuration, private storage and build\n'); process.exitCode = 1; });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user