2
0

🧑‍💻 Improve env variables type safety and management (#718)

Closes #679
This commit is contained in:
Baptiste Arnaud
2023-08-28 09:13:53 +02:00
committed by GitHub
parent a23a8c4456
commit 786e5cb582
148 changed files with 1550 additions and 1293 deletions

View File

@@ -27,7 +27,8 @@
"@typebot.io/lib": "workspace:*",
"eslint": "8.44.0",
"eslint-config-custom": "workspace:*",
"@typebot.io/tsconfig": "workspace:*"
"@typebot.io/tsconfig": "workspace:*",
"@typebot.io/env": "workspace:*"
},
"peerDependencies": {
"@faire/mjml-react": "2.1.4",

View File

@@ -1,20 +1,20 @@
import { createTransport, SendMailOptions } from 'nodemailer'
import { env } from '@typebot.io/lib'
import { env } from '@typebot.io/env'
export const sendEmail = (
props: Pick<SendMailOptions, 'to' | 'html' | 'subject'>
) => {
const transporter = createTransport({
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
host: env.SMTP_HOST,
port: env.SMTP_PORT,
auth: {
user: process.env.SMTP_USERNAME,
pass: process.env.SMTP_PASSWORD,
user: env.SMTP_USERNAME,
pass: env.SMTP_PASSWORD,
},
})
return transporter.sendMail({
from: process.env.SMTP_FROM ?? env('SMTP_FROM'),
from: env.NEXT_PUBLIC_SMTP_FROM,
...props,
})
}