Configure Bun SQLite with WAL mode, foreign keys, and a shared database path for development and production. Add migration commands and startup migration handling, check database connectivity in the health endpoint, and document configuration while excluding local database files from Git.
10 lines
413 B
TypeScript
10 lines
413 B
TypeScript
import { databasePath } from "../src/db/config";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
// Bun's built HTML assets resolve from dist; keep the database path absolute.
|
|
process.env.DATABASE_PATH = databasePath;
|
|
process.env.NODE_ENV = "production";
|
|
process.chdir(fileURLToPath(new URL("../dist", import.meta.url)));
|
|
const entrypoint = new URL("../dist/index.js", import.meta.url).href;
|
|
await import(entrypoint);
|