feat: implement IPC handlers for service lifecycle management including Nginx, PHP, and MySQL orchestration
This commit is contained in:
@@ -426,6 +426,16 @@ export function registerIpcHandlers(): void {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
ipcMain.handle('projects:update', async (_event, project) => {
|
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)
|
const result = projectService.updateProject(project)
|
||||||
// Trigger Nginx restart
|
// Trigger Nginx restart
|
||||||
await restartNginx()
|
await restartNginx()
|
||||||
|
|||||||
Reference in New Issue
Block a user