An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
fix: handle DATABASE_URL properly for test environments
Yoshiki Miurad322b2156512
diff --git a/lib/db/index.ts b/lib/db/index.tsindex 240b8c91..50f10d9a 100644--- a/lib/db/index.ts+++ b/lib/db/index.ts@@ -10,7 +10,15 @@ if (!process.env.DATABASE_URL && process.env.NODE_ENV !== 'test') {}// Connection with connection pooling for server environments-const connectionString = process.env.DATABASE_URL!+const connectionString =+ process.env.DATABASE_URL ??+ (process.env.NODE_ENV === 'test'+ ? 'postgres://user:pass@localhost:5432/testdb'+ : undefined)++if (!connectionString) {+ throw new Error('DATABASE_URL environment variable is not set')+}const client = postgres(connectionString, {ssl: { rejectUnauthorized: false },prepare: false,