Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ jobs:
if: github.event_name != 'pull_request' && hashFiles('trivy-results.sarif') != ''
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
with:
sarif_file: trivy-results.sarif
sarif_file: trivy-results.sarif
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
RUN npx prisma generate
ENV DATABASE_URL=postgresql://localhost:5432/dispatch
RUN npm run build

FROM base AS runner
Expand Down
4 changes: 2 additions & 2 deletions prisma.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from "prisma/config";

const databaseUrl = process.env.DATABASE_URL;

if (!databaseUrl) {
if (process.env.NODE_ENV === "production" && !databaseUrl) {
throw new Error(
"DATABASE_URL is not set. Please set the DATABASE_URL environment variable before starting the application.",
);
Expand All @@ -11,6 +11,6 @@ if (!databaseUrl) {
export default defineConfig({
schema: "prisma/schema.prisma",
datasource: {
url: databaseUrl,
url: databaseUrl ?? "postgresql://localhost:5432/dispatch",
},
});
6 changes: 2 additions & 4 deletions src/lib/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import { PrismaPg } from "@prisma/adapter-pg";
import { PrFixQueueClient } from "@/lib/pr-fix-queue";
import { AgentWorkClient } from "@/lib/agent-work";

const databaseUrl = process.env.DATABASE_URL;

if (!databaseUrl) {
if (process.env.NODE_ENV === "production" && !process.env.DATABASE_URL) {
throw new Error(
"DATABASE_URL is not set. Please set the DATABASE_URL environment variable before starting the application.",
);
}

const adapter = new PrismaPg(databaseUrl);
const adapter = new PrismaPg(process.env.DATABASE_URL!);

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
Expand Down