Spaces:
Sleeping
Sleeping
Commit ·
129a8b9
1
Parent(s): ca278e1
Fix: skip port-killer in production to prevent memory issues
Browse files
Ark.Alliance.StartupCms.Ai.Backend/src/index.ts
CHANGED
|
@@ -328,9 +328,13 @@ const startServer = async () => {
|
|
| 328 |
? USE_HTTPS // Use env var in production
|
| 329 |
: await promptProtocolSelection(); // Interactive in dev
|
| 330 |
|
| 331 |
-
// Ensure port is free before proceeding
|
| 332 |
-
|
| 333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
|
| 335 |
// Initialize database
|
| 336 |
await initializeDatabase();
|
|
|
|
| 328 |
? USE_HTTPS // Use env var in production
|
| 329 |
: await promptProtocolSelection(); // Interactive in dev
|
| 330 |
|
| 331 |
+
// Ensure port is free before proceeding (skip in production/containers)
|
| 332 |
+
if (process.env.NODE_ENV !== 'production') {
|
| 333 |
+
console.log(`Ensuring port ${PORT} is free...`);
|
| 334 |
+
await killPort(PORT);
|
| 335 |
+
} else {
|
| 336 |
+
console.log(`Production mode: skipping port check, using port ${PORT}`);
|
| 337 |
+
}
|
| 338 |
|
| 339 |
// Initialize database
|
| 340 |
await initializeDatabase();
|