use environment variables from cloudflare's environment

This commit is contained in:
Avraham Sakal
2025-09-16 09:09:33 -04:00
parent c98342e886
commit 81338b8831
11 changed files with 323 additions and 268 deletions
+10 -1
View File
@@ -1,12 +1,21 @@
import type { TSchema } from "@sinclair/typebox";
import { TypeCompiler } from "@sinclair/typebox/compiler";
import { initTRPC, TRPCError } from "@trpc/server";
import type { getDb } from "../database/postgres";
import type { getOpenrouter } from "../pages/chat/provider";
/**
* Initialization of tRPC backend
* Should be done only once per backend!
*/
const t = initTRPC.context<object>().create(/*{
const t = initTRPC
.context<
object & {
db: ReturnType<typeof getDb>;
openrouter: ReturnType<typeof getOpenrouter>;
}
>()
.create(/*{
sse: {
maxDurationMs: 5 * 60 * 1_000, // 5 minutes
ping: {