()
| 57 | class ConfigManager { |
| 58 | private readonly configPath: string; |
| 59 | private data: CheckInConfig; |
| 60 | |
| 61 | constructor() { |
| 62 | const dir = createDirectoryInAssets("checkin"); |
| 63 | this.configPath = path.join(dir, "checkin_config.json"); |
| 64 | this.data = this.load(); |
| 65 | } |
| 66 | |
| 67 | private load(): CheckInConfig { |
| 68 | try { |
| 69 | if (!fs.existsSync(this.configPath)) return { ...DEFAULT_CONFIG }; |
| 70 | const raw = JSON.parse(fs.readFileSync(this.configPath, "utf-8")); |
| 71 | const merged = { ...DEFAULT_CONFIG, ...raw }; |
| 72 | merged.targets = Array.isArray(raw?.targets) ? raw.targets : []; |
| 73 | return merged; |
no test coverage detected