Zod validated config for security and ease of getting started

This commit is contained in:
Kalle
2026-06-15 14:12:15 +03:00
parent 215243e071
commit 75179e5077
46 changed files with 386 additions and 275 deletions

View File

@@ -1,4 +1,5 @@
import type { CacheEntry } from "@epic-web/cachified";
import { ServerConfig } from "~/config.server";
import { LRUCache } from "~/modules/cache";
declare global {
@@ -11,8 +12,7 @@ export const cache = (global.__lruCache = global.__lruCache
? global.__lruCache
: new LRUCache<string, CacheEntry<unknown>>({ max: 5000 }));
export const ttl = (ms: number) =>
process.env.DISABLE_CACHE === "true" ? 0 : ms;
export const ttl = (ms: number) => (ServerConfig.disableCache ? 0 : ms);
export function syncCached<T>(key: string, getFreshValue: () => T) {
if (cache.has(key)) {