2026-05-24 00:48:32 +00:00
|
|
|
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"),
|
2026-05-24 03:12:53 +00:00
|
|
|
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),
|
2026-05-24 00:48:32 +00:00
|
|
|
},
|
|
|
|
|
{ unknownKeys: "strip" },
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export type DbConfig = {
|
|
|
|
|
driver: "sqlite" | "postgres";
|
|
|
|
|
sqlitePath: string;
|
2026-05-24 03:12:53 +00:00
|
|
|
url: string;
|
|
|
|
|
host: string;
|
|
|
|
|
port: number;
|
|
|
|
|
database: string;
|
|
|
|
|
user: string;
|
|
|
|
|
password: string;
|
|
|
|
|
poolMax: number;
|
2026-05-24 00:48:32 +00:00
|
|
|
};
|