refactor: dynamic SMTP for self host (#138)
Co-authored-by: KM Koushik <koushikmohan1996@gmail.com>
This commit is contained in:
@@ -8,6 +8,12 @@ import {
|
||||
CardTitle,
|
||||
} from "@unsend/ui/src/card";
|
||||
import { TextWithCopyButton } from "@unsend/ui/src/text-with-copy";
|
||||
import {env} from "~/env";
|
||||
|
||||
|
||||
const host = env.NEXT_PUBLIC_SMTP_HOST;
|
||||
const user = env.NEXT_PUBLIC_SMTP_USER;
|
||||
|
||||
|
||||
export default function ExampleCard() {
|
||||
return (
|
||||
@@ -25,7 +31,7 @@ export default function ExampleCard() {
|
||||
<strong>Host:</strong>
|
||||
<TextWithCopyButton
|
||||
className="ml-1 border bg-primary/10 rounded-lg mt-1 p-2 w-full "
|
||||
value={"smtp.unsend.dev"}
|
||||
value={host}
|
||||
></TextWithCopyButton>
|
||||
</div>
|
||||
<div>
|
||||
@@ -45,7 +51,7 @@ export default function ExampleCard() {
|
||||
<strong>User:</strong>
|
||||
<TextWithCopyButton
|
||||
className="ml-1 rounded-lg mt-1 p-2 w-full bg-primary/10"
|
||||
value={"unsend"}
|
||||
value={user}
|
||||
></TextWithCopyButton>
|
||||
</div>
|
||||
<div>
|
||||
|
@@ -67,6 +67,8 @@ export const env = createEnv({
|
||||
.string()
|
||||
.default("false")
|
||||
.transform((str) => str === "true"),
|
||||
NEXT_PUBLIC_SMTP_HOST: z.string().default("smtp.unsend.dev"),
|
||||
NEXT_PUBLIC_SMTP_USER: z.string().default("unsend"),
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -101,6 +103,8 @@ export const env = createEnv({
|
||||
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
|
||||
STRIPE_BASIC_PRICE_ID: process.env.STRIPE_BASIC_PRICE_ID,
|
||||
STRIPE_WEBHOOK_SECRET: process.env.STRIPE_WEBHOOK_SECRET,
|
||||
NEXT_PUBLIC_SMTP_HOST: process.env.NEXT_PUBLIC_SMTP_HOST,
|
||||
NEXT_PUBLIC_SMTP_USER: process.env.NEXT_PUBLIC_SMTP_USER,
|
||||
},
|
||||
/**
|
||||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
||||
|
Reference in New Issue
Block a user