mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
00cbc5aae3
tests/setup.ts mocks src/config once with tests/helpers/test-config.ts. A suite that needs other values calls overrideTestConfig(), and the setup file restores the defaults after every case. The 191 per-file factories are gone; config.test.ts takes the real module through vi.unmock, and the few suites that signed tokens with their own literal secret read it from TEST_CONFIG.
14 lines
544 B
TypeScript
14 lines
544 B
TypeScript
/**
|
|
* API-docs kill switch (#1412). Deliberately NOT in src/config.ts: that module
|
|
* is frozen at import (and replaced wholesale under test), and reading the env
|
|
* at call time keeps the flag testable per-request (same pattern as plugins/kill-switch.ts).
|
|
*
|
|
* Off by default — the generated spec enumerates every route including the
|
|
* admin surface, so exposing it is an explicit self-hoster decision.
|
|
*/
|
|
import { readEnv } from '../../app-config';
|
|
|
|
export function apiDocsEnabled(): boolean {
|
|
return readEnv().http.apiDocsEnabled;
|
|
}
|