The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | /** |
| 2 | * vinext data-cache adapter builder for Redis. |
| 3 | * |
| 4 | * Node Website.Vinext resources inject this adapter automatically. |
| 5 | * The runtime factory uses {@link connect} from `@alchemy.run/redis` (the same |
| 6 | * client Fly/Railway `*RedisHttp` layers use) and reads `REDIS_URL` |
| 7 | * (or `urlEnv`) from the process environment. |
| 8 | * |
| 9 | * Pair with `Railway.Redis` / `Fly.Redis` so the Website host gets |
| 10 | * `REDIS_URL`. Missing URL (local `vinext start` / `alchemy dev`) makes |
| 11 | * vinext log and fall back to the in-memory handler. |
| 12 | */ |
| 13 | import { fileURLToPath } from "node:url"; |
| 14 | import type { RedisAdapterOptions } from "./redis-runtime.ts"; |
| 15 | |
| 16 | export type { RedisAdapterOptions } from "./redis-runtime.ts"; |
| 17 | |
| 18 | export const DEFAULT_REDIS_URL_ENV = "REDIS_URL"; |
| 19 | |
| 20 | export const redisAdapter = (options?: RedisAdapterOptions) => { |
| 21 | if (options?.urlEnv !== undefined && typeof options.urlEnv !== "string") { |
| 22 | throw new TypeError("[vinext] redisAdapter({ urlEnv }) must be a string env var name."); |
| 23 | } |
| 24 | return { |
| 25 | adapter: fileURLToPath(new URL("./redis-runtime.js", import.meta.url)), |
| 26 | options, |
| 27 | }; |
| 28 | }; |