Skip to content

Commit

Permalink
Create a send wrapper that adds only specific env vars into the template
Browse files Browse the repository at this point in the history
  • Loading branch information
francisli committed Dec 18, 2024
1 parent bc7ca09 commit eb88768
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/backend/lib/db_helpers/case_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export async function sendInviteEmail(
locals: {
case_manager_name,
first_name,
env,
},
});
return;
Expand Down
17 changes: 16 additions & 1 deletion src/backend/lib/nodemailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getTransporter = (env: Env) => {
options.port = parseInt(env.EMAIL_PORT, 10);
}
const transport = createTransport(options);
return new Email({
const email = new Email({
send: true,
transport,
views: {
Expand All @@ -33,4 +33,19 @@ export const getTransporter = (env: Env) => {
juice: false,
preview: false,
});
return {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
send(options: Email.EmailOptions<any>) {
return email.send({
...options,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
locals: {
...options.locals,
env: {
BASE_URL: env.BASE_URL,
},
},
});
},
};
};

0 comments on commit eb88768

Please sign in to comment.