cleanups/refactor of the entire main branch
All checks were successful
Build and Push to Gitea Registry / build-and-push (push) Successful in 6m40s

This commit is contained in:
2026-03-15 23:29:10 +05:30
parent 994c7eab86
commit 95a9a62704
8 changed files with 65 additions and 163 deletions

View File

@@ -1,4 +1,4 @@
import { em, entity, text, boolean, libsql } from "bknd";
import { em, entity, text, boolean, libsql, type Connection } from "bknd";
import type { TanstackStartConfig } from "bknd/adapter/tanstack-start";
import { registerLocalMediaAdapter } from "bknd/adapter/node";
@@ -19,10 +19,17 @@ declare module "bknd" {
interface DB extends Database { }
}
function getDBConnection(): Connection | { url: ":memory:" | (string & {}) } {
if (process.env.NODE_ENV !== "production") return { url: ":memory:" };
return libsql({
url: process.env.DATABASE_URL,
})
}
export default {
connection: libsql({
url: process.env.DATABASE_URL || "http://localhost:8080",
}),
connection: getDBConnection(),
options: {
// the seed option is only executed if the database was empty
seed: async (ctx) => {