Files
Kevin L'Hereec f9e56c78b1 refactor: migrate all internal imports to package.json subpath aliases
- Add #domain, #protocol, #utils aliases to package.json imports map
- Replace all relative imports (./, ../, ../..) in app/ and
  database/mongo_migrations/ with the corresponding #alias imports,
  eliminating relative path traversal across the codebase
- Remove dead code: ConfigurationVersionModel.findByConfigurationIdentifier
  (unused, superseded by paginateVersions) and unused exception classes
  (NotFoundException, UnprocessableEntityException, DatabaseException)
  from app/exceptions/index.ts, keeping only BadRequestException
- Fix pre-existing syntax error in configuration_version.ts (mismatched
  parenthesis) that broke tsc
- Fix eqeqeq violation in configuration_service.ts and isNaN ->
  Number.isNaN in configuration_engine.ts / cwmp-1-0.ts / exchange_controller.ts
- Fix no-shadow violation in cwmp-1-0.ts EventStruct constructor
- Prettier formatting pass on touched files

Validated: tsc --noEmit clean, eslint app/ clean, full test suite green.
2026-07-22 11:45:14 +02:00

26 lines
709 B
TypeScript

import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import type { ReferencesConfig } from '#services/references/types'
const CONFIG_PATH = join(process.cwd(), 'config', 'references.json')
let cachedConfig: ReferencesConfig | null = null
export function loadReferencesConfig(): ReferencesConfig {
if (cachedConfig) return cachedConfig
try {
const raw = readFileSync(CONFIG_PATH, 'utf-8')
cachedConfig = JSON.parse(raw) as ReferencesConfig
return cachedConfig
} catch (_error: any) {
cachedConfig = { providers: [] }
return cachedConfig
}
}
export function reloadReferencesConfig(): ReferencesConfig {
cachedConfig = null
return loadReferencesConfig()
}