feat: implement IPC handlers for service lifecycle management including Nginx, PHP, and MySQL orchestration

This commit is contained in:
Ümit Tunç
2026-03-30 08:25:11 +03:00
parent c5d6635f01
commit ca566576ed
+10
View File
@@ -426,6 +426,16 @@ export function registerIpcHandlers(): void {
return result
})
ipcMain.handle('projects:update', async (_event, project) => {
// Clean up old config file if host changed
const projects = projectService.getProjects()
const oldProject = projects.find(p => p.id === project.id)
if (oldProject && oldProject.host !== project.host) {
const oldConfigPath = path.join(configService.getBasePath(), 'generated_configs', 'projects', `${oldProject.host}.conf`)
if (fs.existsSync(oldConfigPath)) {
try { fs.unlinkSync(oldConfigPath) } catch (e) { console.error('Error deleting old config:', e) }
}
}
const result = projectService.updateProject(project)
// Trigger Nginx restart
await restartNginx()