Skip to content

Commit faaf04b

Browse files
Revert "CM-1485-do not call setSecret (#333)" (#43)
This reverts commit a541431.
1 parent bbadf95 commit faaf04b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/firebase/env/dev/env_secrets.dev.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"apiKey": "notrealapikey"
44
},
55
"mail": {
6-
"SENDGRID_API_KEY": ""
6+
"SENDGRID_API_KEY": "SG.Gxxxxx"
77
}
88
}

packages/firebase/functions/src/notification/email/mailer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ const SENDGRID_APIKEY = 'SENDGRID_APIKEY';
88
const setApiKey = async () => {
99
const apiKey = await getSecret(SENDGRID_APIKEY);
1010
sendgrid.setApiKey(apiKey);
11-
env.mail.SENDGRID_API_KEY = apiKey;
1211
}
1312

1413
export const sendMail = async (dest: string, subject: string, message: string, from = env.mail.sender, bcc = null): Promise<void> => {
15-
// if env.mail.SENDGRID_API_KEY has no value, set it with apiKey
16-
!env.mail.SENDGRID_API_KEY && await setApiKey();
14+
// @question Moore, why are we awaiting this on every single mail we send?
15+
await setApiKey();
1716

1817
await sendgrid.send({
1918
to: dest,

0 commit comments

Comments
 (0)