import { backupConfig } from "../src/ops/backups";
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";
const backups = backupConfig(databasePath);
process.env.BACKUP_DIR = backups.directory;
if (backups.replica) process.env.BACKUP_REPLICA_DIR = backups.replica;
process.chdir(fileURLToPath(new URL("../dist", import.meta.url)));
const entrypoint = new URL("../dist/index.js", import.meta.url).href;
await import(entrypoint);
