Skip to content

Commit

Permalink
Set DATABASE_URL as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoVictor committed Jul 9, 2024
1 parent 9e0fbbe commit b2a5d99
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/env.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const { z } = require("zod");

const schema = z.object({
DATABASE_URL:
process.env.NODE_ENV === "dev"
? z.string({
required_error: "Missing DATABASE_URL in environment variable",
})
: z.undefined(),
DATABASE_URL: z
.string({
required_error: "Missing DATABASE_URL in environment variable",
})
.optional(),
PORT: z.coerce
.number({
invalid_type_error: "PORT must be a number",
Expand Down

0 comments on commit b2a5d99

Please sign in to comment.