Skip to content

Commit

Permalink
Made env optional for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraissman committed Nov 3, 2024
1 parent d502d7d commit ccb756f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/email/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export async function sendEmailVerification(
toEmail: string,
code: string,
): Promise<boolean> {
sgMail.setApiKey(env.SENDGRID_API_KEY);
sgMail.setApiKey(env.SENDGRID_API_KEY ?? "");

const msg = {
to: toEmail,
from: env.VERIFICATION_FROM_EMAIL,
from: env.VERIFICATION_FROM_EMAIL ?? "",
subject: "Verify Your Email - Good Dog Licensing",
html: `<p>Your Verification Code: <strong>${code}</strong></p>`,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/env/src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const env = createEnv({
NODE_ENV: z
.enum(["development", "test", "production"])
.default("development"),
SENDGRID_API_KEY: z.string(),
VERIFICATION_FROM_EMAIL: z.string().email(),
SENDGRID_API_KEY: z.string().optional(),
VERIFICATION_FROM_EMAIL: z.string().email().optional(),
},

/**
Expand Down

0 comments on commit ccb756f

Please sign in to comment.