Skip to content

Commit

Permalink
fix: allow empty string in SENDGRID_FROM_ADDRESS env var validation (#…
Browse files Browse the repository at this point in the history
…161)

since it is optional
  • Loading branch information
karrui authored Jun 30, 2023
1 parent b7567d9 commit 3f7d014
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ const server = z
OTP_EXPIRY: z.coerce.number().positive().optional().default(600),
POSTMAN_API_KEY: z.string().optional(),
SENDGRID_API_KEY: z.string().optional(),
SENDGRID_FROM_ADDRESS: z.string().email().optional(),
SENDGRID_FROM_ADDRESS: z.union([
z.string().email().optional(),
z.string().length(0),
]),
SESSION_SECRET: z.string().min(32),
})
// Add on schemas as needed that requires conditional validation.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const sendMail = async (params: SendMailParams): Promise<void> => {
}

console.warn(
'POSTMAN_API_KEY or POSTMARK_API_TOKEN missing. Logging the following mail: ',
'POSTMAN_API_KEY or SENDGRID_API_KEY missing. Logging the following mail: ',
params
)
return
Expand Down

1 comment on commit 3f7d014

@vercel
Copy link

@vercel vercel bot commented on 3f7d014 Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.