Commit iniziale

This commit is contained in:
2026-03-05 14:45:06 +01:00
commit 7008f57119
13 changed files with 5162 additions and 0 deletions

20
services/configService.js Normal file
View File

@@ -0,0 +1,20 @@
const fs = require('fs-extra');
const path = require('path');
const os = require('os');
const configPath = path.join(os.homedir(), '.cad-router-config.json');
const defaultConfigPath = path.join(__dirname, '..', 'config', 'defaultConfig.json');
async function loadConfig() {
if (await fs.pathExists(configPath)) {
return fs.readJson(configPath);
}
const defaultConfig = await fs.readJson(defaultConfigPath);
await fs.writeJson(configPath, defaultConfig, { spaces: 2 });
return defaultConfig;
}
loadConfig.getConfigPath = () => configPath;
module.exports = { loadConfig };