cpns / packages /db /src /database-url.ts
rogasper's picture
feat: add db:seed command to package.json and update README.md for seeding reference data. Enhance job status handling in generation logic to support completed_partial status, improving error reporting and user feedback. Introduce new utility functions for job outcome resolution and non-retryable error detection, along with corresponding tests. Update database migration scripts to include new tables and fields for improved data management.
ef46e44
Raw
History Blame Contribute Delete
653 Bytes
import { existsSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import dotenv from "dotenv";
const serverEnvPath = resolve(dirname(fileURLToPath(import.meta.url)), "../../../apps/server/.env");
export function loadDatabaseUrl(): string {
if (!process.env.DATABASE_URL && existsSync(serverEnvPath)) {
dotenv.config({ path: serverEnvPath });
}
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error(
"DATABASE_URL is not set. Add it to Coolify environment variables (or apps/server/.env for local dev).",
);
}
return databaseUrl;
}