Faithful port of AtomCMS's "atom" theme look (light, Habbo-retro, golden #eeb425 / amber #f59e0b accents, white cards, 12px radii, Nunito-first stack): - globals.css: full token set + components (.site-header/.nav-item, .btn-*, .card, .hero, currency pills, article cards, inputs, tables, footer). - SiteHeader (brand + nav + currency pills + auth box, staff-aware) + SiteFooter; layout wraps header/content/footer. Removed the bare SiteNav. - Restyled home (hero + article cards), login (centered card). - siteSettings now falls back to DEFAULTS on missing key OR DB error, so pages render without a DB; DATABASE_CONNECT_TIMEOUT_MS env + pool acquireTimeout make the no-DB fallback fast. Verified in a real browser (computed styles): header white/sticky, golden logo gradient, uppercase nav, amber primary button @12px radius, golden outline, hero gradient — all correct. tsc exit 0, vitest 48/48, next build exit 0.
29 lines
1012 B
TypeScript
29 lines
1012 B
TypeScript
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
import { PrismaClient } from "@/generated/prisma/client";
|
|
import { env } from "@/env";
|
|
|
|
const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };
|
|
|
|
function createPrismaClient(): PrismaClient {
|
|
const url = new URL(env.DATABASE_URL);
|
|
const adapter = new PrismaMariaDb({
|
|
host: url.hostname,
|
|
port: Number(url.port) || 3306,
|
|
user: decodeURIComponent(url.username),
|
|
password: decodeURIComponent(url.password),
|
|
database: url.pathname.replace(/^\//, ""),
|
|
connectionLimit: env.DATABASE_POOL_SIZE,
|
|
connectTimeout: env.DATABASE_CONNECT_TIMEOUT_MS,
|
|
acquireTimeout: env.DATABASE_CONNECT_TIMEOUT_MS,
|
|
idleTimeout: env.DATABASE_IDLE_TIMEOUT_MS,
|
|
});
|
|
return new PrismaClient({
|
|
adapter,
|
|
log: env.NODE_ENV === "development" ? ["error", "warn"] : ["error"],
|
|
});
|
|
}
|
|
|
|
export const prisma = globalForPrisma.prisma ?? createPrismaClient();
|
|
|
|
if (env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|