(rootDir: string)
| 269 | |
| 270 | public static getInstance(): ConfigManager { |
| 271 | if (!ConfigManager.instance) { |
| 272 | ConfigManager.instance = new ConfigManager(); |
| 273 | } |
| 274 | return ConfigManager.instance; |
| 275 | } |
| 276 | |
| 277 | public load(rootDir: string): DataConfig { |
| 278 | this.configPath = path.join(rootDir, "data", "config.json"); |
| 279 | this.configData = {}; |
| 280 | this.fileConfigData = {}; |
| 281 | if (fs.existsSync(this.configPath)) { |
| 282 | try { |
| 283 | const parsed = JSON.parse(fs.readFileSync(this.configPath, "utf-8")) as unknown; |
| 284 | if ( |
| 285 | parsed && |
| 286 | typeof parsed === "object" && |
| 287 | "scheduledJobs" in (parsed as Record<string, unknown>) |
| 288 | ) { |
| 289 | console.warn( |
| 290 | ' Warning: data/config.json contains deprecated "scheduledJobs". Move them to job.json at the pack root; the old field is ignored.', |
| 291 | ); |
| 292 | } |
| 293 | this.fileConfigData = normalizeDataConfig(parsed); |
| 294 | console.log(" Loaded config from data/config.json"); |
| 295 | } catch (err) { |
| 296 | console.warn(" Warning: Failed to parse data/config.json:", err); |
| 297 | } |
| 298 | } |
no test coverage detected