diff --git a/api/ecosystem.config.json b/api/ecosystem.config.json index add86b5ce..ee7ab00f0 100644 --- a/api/ecosystem.config.json +++ b/api/ecosystem.config.json @@ -2,13 +2,14 @@ "apps": [ { "name": "unraid-api", - "script": "npm", - "args": "start", + "script": "./dist/main.js", "cwd": "/usr/local/unraid-api", "log": "/var/log/unraid-api/unraid-api.log", "exec_mode": "fork", "wait_ready": true, "listen_timeout": 30000, + "max_restarts": 10, + "min_uptime": 10000, "ignore_watch": [ "node_modules", "src", @@ -17,4 +18,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/api/src/unraid-api/auth/api-key.service.spec.ts b/api/src/unraid-api/auth/api-key.service.spec.ts index 1a2a44221..0c3b82c5e 100644 --- a/api/src/unraid-api/auth/api-key.service.spec.ts +++ b/api/src/unraid-api/auth/api-key.service.spec.ts @@ -91,7 +91,6 @@ describe('ApiKeyService', () => { vi.mocked(ensureDir).mockResolvedValue(); apiKeyService = new ApiKeyService(); - await apiKeyService.initialize(); vi.spyOn(apiKeyService as any, 'generateApiKey').mockReturnValue('test-api-key'); vi.mock('uuid', () => ({ @@ -113,12 +112,8 @@ describe('ApiKeyService', () => { describe('initialization', () => { it('should ensure directory exists', async () => { - vi.mocked(ensureDir).mockResolvedValue(); const service = new ApiKeyService(); - - await service.initialize(); - - expect(ensureDir).toHaveBeenCalledWith(mockBasePath); + expect(ensureDirSync).toHaveBeenCalledWith(mockBasePath); }); it('should return correct paths', async () => { diff --git a/api/src/unraid-api/main.ts b/api/src/unraid-api/main.ts index 6832529bb..977bb4e68 100644 --- a/api/src/unraid-api/main.ts +++ b/api/src/unraid-api/main.ts @@ -54,6 +54,8 @@ export async function bootstrapNestServer(): Promise { // See https://pm2.keymetrics.io/docs/usage/signals-clean-restart/ if (process.send) { process.send('ready'); + } else { + console.log('Warning: process.send is unavailable. This will affect IPC communication with PM2.'); } apiLogger.info('Nest Server is now listening');