diff --git a/dashcaddy-api/VERSION b/dashcaddy-api/VERSION index 8ee696e..3395ff3 100644 --- a/dashcaddy-api/VERSION +++ b/dashcaddy-api/VERSION @@ -1 +1 @@ -c64bbe2 +db14233 diff --git a/dashcaddy-api/server.js b/dashcaddy-api/server.js index 421b6e5..3c16518 100644 --- a/dashcaddy-api/server.js +++ b/dashcaddy-api/server.js @@ -3,6 +3,7 @@ * Minimal startup script - all logic moved to src/ */ const { createApp } = require('./src/app'); +const { fetchT } = require('./src/utils/http'); const platformPaths = require('./platform-paths'); // Unhandled error handlers @@ -66,6 +67,10 @@ process.on('uncaughtException', (error) => { const selfUpdater = require('./self-updater'); const portLockManager = require('./port-lock-manager'); + // Create servicesStateManager early — needed by workflow engine init + const StateManager = require('./state-manager'); + const servicesStateManager = new StateManager(SERVICES_FILE); + // Optional modules let dockerMaintenance, logDigest, bundledWorkflows; try { dockerMaintenance = require('./docker-maintenance'); } catch { /* optional */ } @@ -80,7 +85,7 @@ process.on('uncaughtException', (error) => { // Create a context with needed services const workflowCtx = { docker: { client: require('dockerode')() }, - notification: require('./notification-manager')({ + notification: new (require('./notification-manager'))({ NOTIFICATIONS_FILE: process.env.NOTIFICATIONS_FILE || require('./platform-paths').notificationsFile, fetchT, log, @@ -133,9 +138,7 @@ process.on('uncaughtException', (error) => { (async () => { try { const { syncHealthCheckerServices } = require('./startup-validator'); - const StateManager = require('./state-manager'); - const servicesStateManager = new StateManager(SERVICES_FILE); - + await syncHealthCheckerServices({ log, SERVICES_FILE,