mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Check if the env is local
This commit is contained in:
parent
d86a6038ea
commit
9762b14ebc
1 changed files with 7 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { MailService } from '@sendgrid/mail'
|
||||
import { MailDataRequired } from '@sendgrid/helpers/classes/mail'
|
||||
import { env } from '../env'
|
||||
|
||||
type SendGridResponse = {
|
||||
body?: string
|
||||
|
|
@ -23,8 +24,12 @@ const asSendGridError = (error: any): SendGridError | undefined => {
|
|||
export const sendEmail = async (msg: MailDataRequired): Promise<boolean> => {
|
||||
const client = new MailService()
|
||||
if (!process.env.SENDGRID_MSGS_API_KEY) {
|
||||
console.log('SendGrid API key not set.\nSending email:', msg)
|
||||
return true
|
||||
if (env.dev.isLocal) {
|
||||
console.log('SendGrid API key not set.\nSending email:', msg)
|
||||
return true
|
||||
}
|
||||
|
||||
throw 'SendGrid API key not set'
|
||||
}
|
||||
|
||||
client.setApiKey(process.env.SENDGRID_MSGS_API_KEY)
|
||||
|
|
|
|||
Loading…
Reference in a new issue