All checks were successful
Build and Deploy / Build & Push (push) Successful in 3m50s
- next.config.ts: CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy - sixflags.ts: cap Retry-After at 5 min; add 15s AbortSignal.timeout() - queuetimes.ts: add 10s AbortSignal.timeout() - rcdb.ts: add 15s AbortSignal.timeout() - lib/env.ts: parseStalenessHours() guards against NaN from invalid env vars - db.ts + park-meta.ts: use parseStalenessHours() for staleness window config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
14 lines
495 B
TypeScript
14 lines
495 B
TypeScript
/**
|
|
* Environment variable helpers.
|
|
*/
|
|
|
|
/**
|
|
* Parse a staleness window from an env var string (interpreted as hours).
|
|
* Falls back to `defaultHours` when the value is missing, non-numeric,
|
|
* non-finite, or <= 0 — preventing NaN from silently breaking staleness checks.
|
|
*/
|
|
export function parseStalenessHours(envVar: string | undefined, defaultHours: number): number {
|
|
const parsed = parseInt(envVar ?? "", 10);
|
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : defaultHours;
|
|
}
|