mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-17 18:36:37 +00:00
use config file instead of env
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
export * from "@server/emails/sendEmail";
|
||||
|
||||
import nodemailer from "nodemailer";
|
||||
import environment from "@server/environment";
|
||||
import config from "@server/config";
|
||||
import logger from "@server/logger";
|
||||
|
||||
function createEmailClient() {
|
||||
if (
|
||||
!environment.EMAIL_SMTP_HOST ||
|
||||
!environment.EMAIL_SMTP_PORT ||
|
||||
!environment.EMAIL_SMTP_USER ||
|
||||
!environment.EMAIL_SMTP_PASS
|
||||
!config.email?.smtp_host ||
|
||||
!config.email?.smtp_pass ||
|
||||
!config.email?.smtp_port ||
|
||||
!config.email?.smtp_user
|
||||
) {
|
||||
logger.warn(
|
||||
"Email SMTP configuration is missing. Emails will not be sent.",
|
||||
@@ -18,12 +18,12 @@ function createEmailClient() {
|
||||
}
|
||||
|
||||
return nodemailer.createTransport({
|
||||
host: environment.EMAIL_SMTP_HOST,
|
||||
port: environment.EMAIL_SMTP_PORT,
|
||||
host: config.email.smtp_host,
|
||||
port: config.email.smtp_port,
|
||||
secure: false,
|
||||
auth: {
|
||||
user: environment.EMAIL_SMTP_USER,
|
||||
pass: environment.EMAIL_SMTP_PASS,
|
||||
user: config.email.smtp_user,
|
||||
pass: config.email.smtp_pass,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import logger from "@server/logger";
|
||||
export async function sendEmail(
|
||||
template: ReactElement,
|
||||
opts: {
|
||||
from: string;
|
||||
to: string;
|
||||
from: string | undefined;
|
||||
to: string | undefined;
|
||||
subject: string;
|
||||
},
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user