Skip to content

Commit ea9b678

Browse files
committed
made the types optional based on requested changes
1 parent 6c5fe90 commit ea9b678

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

apps/webapp/app/env.server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const EnvironmentSchema = z.object({
2828
FROM_EMAIL: z.string().optional(),
2929
REPLY_TO_EMAIL: z.string().optional(),
3030
RESEND_API_KEY: z.string().optional(),
31-
SMTP_HOST: z.string(),
32-
SMTP_PORT: z.number(),
33-
SMTP_USER: z.string(),
34-
SMTP_PASSWORD: z.string(),
31+
SMTP_HOST: z.string().optional(),
32+
SMTP_PORT: z.number().optional(),
33+
SMTP_USER: z.string().optional(),
34+
SMTP_PASSWORD: z.string().optional(),
3535
PLAIN_API_KEY: z.string().optional(),
3636
RUNTIME_PLATFORM: z.enum(["docker-compose", "ecs", "local"]).default("local"),
3737
});

apps/webapp/app/services/email.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { workerQueue } from "./worker.server";
99

1010
const client = new EmailClient({
1111
smtpConfig: {
12-
host:env.SMTP_HOST,
12+
host: env.SMTP_HOST,
1313
secure: true,
1414
port: env.SMTP_PORT,
1515
auth: {
1616
user: env.SMTP_USER,
1717
pass: env.SMTP_PASSWORD,
1818
},
19-
},
19+
},
2020
imagesBaseUrl: env.APP_ORIGIN,
2121
from: env.FROM_EMAIL ?? "[email protected]",
2222
replyTo: env.REPLY_TO_EMAIL ?? "[email protected]",

packages/emails/src/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export const DeliverEmailSchema = z
4343
export type DeliverEmail = z.infer<typeof DeliverEmailSchema>;
4444

4545
export type NodeMailerTransportOptions = {
46-
host: string;
47-
port: number;
48-
secure: boolean;
49-
auth: {
50-
user: string;
51-
pass: string;
46+
host?: string;
47+
port?: number;
48+
secure?: boolean;
49+
auth?: {
50+
user?: string;
51+
pass?: string;
5252
};
5353
};
5454

@@ -59,12 +59,12 @@ export class EmailClient {
5959
#replyTo: string;
6060

6161
constructor(config: {
62-
smtpConfig: NodeMailerTransportOptions;
62+
smtpConfig?: NodeMailerTransportOptions;
6363
imagesBaseUrl: string;
6464
from: string;
6565
replyTo: string;
6666
}) {
67-
this.#client = nodemailer.createTransport(config.smtpConfig);
67+
this.#client = config.smtpConfig ? nodemailer.createTransport(config.smtpConfig) : undefined;
6868
this.#imagesBaseUrl = config.imagesBaseUrl;
6969
this.#from = config.from;
7070
this.#replyTo = config.replyTo;

0 commit comments

Comments
 (0)