BetterFrame/server/src/shared/db/config.ts
Mitchell R 2e88d891e1
fix(db): clean config field names under db: object
Removed redundant pg prefix — fields already nested under db:.
pgHost→host, pgPort→port, pgDatabase→database, pgUser→user,
pgPassword→password, pgPoolMax→poolMax, pgUrl→url.

Updated all 3 plugin schemas, shared DbConfig type, init.ts,
and sec-config template.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-24 05:12:53 +02:00

28 lines
814 B
TypeScript

import * as av from "@anyvali/js";
export const dbConfigSchema = av.object(
{
driver: av.enum_(["sqlite", "postgres"] as const).default("postgres"),
sqlitePath: av.string().minLength(1).default("/var/lib/betterframe/betterframe.db"),
url: av.string().default(""),
host: av.string().default("postgres"),
port: av.int().min(1).max(65535).default(5432),
database: av.string().default("betterframe"),
user: av.string().default("betterframe"),
password: av.string().default("betterframe"),
poolMax: av.int().min(1).max(1000).default(10),
},
{ unknownKeys: "strip" },
);
export type DbConfig = {
driver: "sqlite" | "postgres";
sqlitePath: string;
url: string;
host: string;
port: number;
database: string;
user: string;
password: string;
poolMax: number;
};