feat: implement process management service and base application UI structure
This commit is contained in:
@@ -29,6 +29,29 @@ function findExecutable(dir: string, name: string): string | null {
|
||||
|
||||
export function registerIpcHandlers(): void {
|
||||
// Service management
|
||||
ipcMain.handle('services:reload', async (_event, serviceName: string) => {
|
||||
if (serviceName !== 'nginx') return { success: false, message: 'Yalnızca Nginx için reload desteklenmektedir.' }
|
||||
|
||||
try {
|
||||
// Re-generate config
|
||||
const binDir = path.join(configService.getBasePath(), 'bin')
|
||||
const nginxDir = path.join(binDir, 'nginx')
|
||||
const nginxVersions = fs.readdirSync(nginxDir).filter(f => fs.statSync(path.join(nginxDir, f)).isDirectory())
|
||||
const activeVersion = nginxVersions[0] // Simplify: use first installed
|
||||
if (!activeVersion) throw new Error('Nginx sürümü bulunamadı.')
|
||||
|
||||
const nginxPrefix = path.join(nginxDir, activeVersion)
|
||||
const binPath = path.join(nginxPrefix, 'nginx.exe')
|
||||
const configPath = path.join(configService.getBasePath(), 'generated_configs', 'nginx.conf')
|
||||
|
||||
// For reload, we need the same prefix and config
|
||||
const success = await processManager.runOnce(binPath, ['-p', nginxPrefix, '-c', configPath, '-s', 'reload'], 'nginx')
|
||||
return { success, message: success ? 'Nginx yapılandırması yeniden yüklendi.' : 'Nginx reload hatası (Nginx çalışmıyor olabilir).' }
|
||||
} catch (error: any) {
|
||||
return { success: false, message: `Reload hatası: ${error.message}` }
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('services:start', async (_event, serviceName: string) => {
|
||||
try {
|
||||
const settings = configService.getSettings()
|
||||
|
||||
Reference in New Issue
Block a user