import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; import service from '../core/BaseService.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const configPath = path.join(__dirname, '../config.json'); class ConfigService extends service { constructor() { super(); } read() { try { return JSON.parse(fs.readFileSync(configPath, 'utf-8')); } catch { return {}; } } write(newConfig) { try { fs.writeFileSync(configPath, JSON.stringify(newConfig, null, 2), 'utf-8'); return true; } catch { return false; } } };