Start server when loaded by the PM2 fork container

This commit is contained in:
2026-10-09 17:56:37 +09:00
parent f09b661ac0
commit 736da09846
3 changed files with 17 additions and 3 deletions
+2 -1
View File
@@ -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; });
}