mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
refactor(server): non-DI islands read env via app-config
This commit is contained in:
@@ -1,22 +1,7 @@
|
||||
/**
|
||||
* MCP tuning knobs from the environment (#1414). Pure parsers, kept free of
|
||||
* imports so units can test them without dragging in the MCP SDK.
|
||||
* MCP tuning knobs from the environment (#1414). The parsers moved into the
|
||||
* app-config layer (src/app-config/parsers.ts) — this module re-exports them
|
||||
* so existing import paths keep working. mcp/index.ts consumes the derived
|
||||
* values via readEnv().mcp.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Session idle TTL in SECONDS via MCP_SESSION_TTL, default 1 hour, clamped to
|
||||
* 24h so a milliseconds-value typo can't produce a 1000-hour session.
|
||||
*/
|
||||
export function resolveSessionTtlMs(raw: string | undefined): number {
|
||||
const parsed = Number.parseInt(raw ?? "");
|
||||
return Number.isFinite(parsed) && parsed > 0 ? Math.min(parsed, 24 * 60 * 60) * 1000 : 60 * 60 * 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* SSE keep-alive interval in SECONDS via MCP_SSE_KEEPALIVE, default 25s
|
||||
* (below common proxy idle timeouts like nginx-ingress's 60s). 0 disables.
|
||||
*/
|
||||
export function resolveKeepaliveMs(raw: string | undefined): number {
|
||||
const parsed = Number.parseInt(raw ?? "");
|
||||
return Number.isFinite(parsed) && parsed >= 0 ? parsed * 1000 : 25_000;
|
||||
}
|
||||
export { resolveSessionTtlMs, resolveKeepaliveMs } from '../app-config/parsers';
|
||||
|
||||
Reference in New Issue
Block a user