feat: extract constants module (P2-10)

Centralises magic numbers and string literals into src/config/constants.ts
(FEED_MAX_BYTES, MAX_FEED_ITEMS, MAX_METADATA_EMAILS, ADMIN_COOKIE_MAX_AGE,
FORWARD_EMAIL_IPS_CACHE_TTL_MS, DEFAULT_LEASE_SECONDS, MAX_LEASE_SECONDS,
FEEDS_LIST_KEY). Consumers updated in storage.ts and feed-fetcher.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-22 10:55:01 +02:00
parent 582108a8e3
commit 0c0669c473
3 changed files with 31 additions and 5 deletions
+23
View File
@@ -0,0 +1,23 @@
/** Maximum total size of emails stored per feed (bytes). */
export const FEED_MAX_BYTES = 524288; // 512 KB
/** Cache TTL for ForwardEmail.net IP list (milliseconds). */
export const FORWARD_EMAIL_IPS_CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
/** Admin session cookie max-age (seconds). */
export const ADMIN_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; // 1 week
/** Maximum number of feed items exposed in RSS/Atom responses. */
export const MAX_FEED_ITEMS = 20;
/** Maximum number of email entries kept in feed metadata. */
export const MAX_METADATA_EMAILS = 50;
/** Default WebSub lease duration (seconds). */
export const DEFAULT_LEASE_SECONDS = 86400; // 24 hours
/** Maximum WebSub lease duration (seconds). */
export const MAX_LEASE_SECONDS = 30 * 24 * 3600; // 30 days
/** KV key for the global feed list. */
export const FEEDS_LIST_KEY = "feeds:list";