mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
added secure as a env var for email
This commit is contained in:
parent
954260c28f
commit
f073de1691
@ -16,6 +16,7 @@ export type EmailConfig = {
|
||||
password: string,
|
||||
senderEmail: string,
|
||||
senderName: string,
|
||||
secure: boolean,
|
||||
type: 'shared' | 'standard',
|
||||
}
|
||||
|
||||
@ -35,6 +36,7 @@ export async function sendEmail({
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: emailConfig.host,
|
||||
port: emailConfig.port,
|
||||
secure: emailConfig.secure,
|
||||
auth: {
|
||||
user: emailConfig.username,
|
||||
pass: emailConfig.password,
|
||||
@ -67,6 +69,7 @@ async function getDBInfo(projectId: string, projectUserId: string): Promise<{
|
||||
}
|
||||
|
||||
let emailConfig: EmailConfig;
|
||||
const secure = process.env.EMAIL_SECURE === undefined ? true : process.env.EMAIL_SECURE === 'true';
|
||||
if (projectEmailConfig.type === 'shared') {
|
||||
emailConfig = {
|
||||
host: getEnvVariable('EMAIL_HOST'),
|
||||
@ -75,6 +78,7 @@ async function getDBInfo(projectId: string, projectUserId: string): Promise<{
|
||||
password: getEnvVariable('EMAIL_PASSWORD'),
|
||||
senderEmail: getEnvVariable('EMAIL_SENDER'),
|
||||
senderName: projectEmailConfig.senderName,
|
||||
secure: secure,
|
||||
type: 'shared',
|
||||
};
|
||||
} else {
|
||||
@ -85,6 +89,7 @@ async function getDBInfo(projectId: string, projectUserId: string): Promise<{
|
||||
password: projectEmailConfig.password,
|
||||
senderEmail: projectEmailConfig.senderEmail,
|
||||
senderName: projectEmailConfig.senderName,
|
||||
secure: secure, // TODO: add secure to projectEmailConfig
|
||||
type: 'standard',
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user