refactor: dynamic SMTP for self host (#138)
Co-authored-by: KM Koushik <koushikmohan1996@gmail.com>
This commit is contained in:
@@ -5,6 +5,9 @@ REDIS_URL="redis://localhost:6379"
|
|||||||
|
|
||||||
NEXTAUTH_URL="http://localhost:3000"
|
NEXTAUTH_URL="http://localhost:3000"
|
||||||
|
|
||||||
|
NEXT_PUBLIC_SMTP_HOST=smtp.mailtrap.io # Example SMTP host
|
||||||
|
NEXT_PUBLIC_SMTP_USER=test_userdadad@example.com # Example SMTP user
|
||||||
|
|
||||||
|
|
||||||
AWS_DEFAULT_REGION="us-east-1"
|
AWS_DEFAULT_REGION="us-east-1"
|
||||||
AWS_SECRET_KEY="some-secret-key"
|
AWS_SECRET_KEY="some-secret-key"
|
||||||
|
@@ -12,6 +12,10 @@ DATABASE_URL="postgresql://postgres:postgres@postgres:5432/unsend"
|
|||||||
NEXTAUTH_URL="http://localhost:3000"
|
NEXTAUTH_URL="http://localhost:3000"
|
||||||
NEXTAUTH_SECRET=
|
NEXTAUTH_SECRET=
|
||||||
|
|
||||||
|
#SMTP
|
||||||
|
NEXT_PUBLIC_SMTP_HOST=smtp.mailtrap.io # Example SMTP host
|
||||||
|
NEXT_PUBLIC_SMTP_USER= "unsend" # Example SMTP user
|
||||||
|
|
||||||
## Auth providers any one is required
|
## Auth providers any one is required
|
||||||
# Github login - required
|
# Github login - required
|
||||||
GITHUB_ID="<your-github-client-id>"
|
GITHUB_ID="<your-github-client-id>"
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ node_modules
|
|||||||
# Testing
|
# Testing
|
||||||
coverage
|
coverage
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
# Turbo
|
# Turbo
|
||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
|
@@ -8,6 +8,12 @@ import {
|
|||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@unsend/ui/src/card";
|
} from "@unsend/ui/src/card";
|
||||||
import { TextWithCopyButton } from "@unsend/ui/src/text-with-copy";
|
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() {
|
export default function ExampleCard() {
|
||||||
return (
|
return (
|
||||||
@@ -25,7 +31,7 @@ export default function ExampleCard() {
|
|||||||
<strong>Host:</strong>
|
<strong>Host:</strong>
|
||||||
<TextWithCopyButton
|
<TextWithCopyButton
|
||||||
className="ml-1 border bg-primary/10 rounded-lg mt-1 p-2 w-full "
|
className="ml-1 border bg-primary/10 rounded-lg mt-1 p-2 w-full "
|
||||||
value={"smtp.unsend.dev"}
|
value={host}
|
||||||
></TextWithCopyButton>
|
></TextWithCopyButton>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -45,7 +51,7 @@ export default function ExampleCard() {
|
|||||||
<strong>User:</strong>
|
<strong>User:</strong>
|
||||||
<TextWithCopyButton
|
<TextWithCopyButton
|
||||||
className="ml-1 rounded-lg mt-1 p-2 w-full bg-primary/10"
|
className="ml-1 rounded-lg mt-1 p-2 w-full bg-primary/10"
|
||||||
value={"unsend"}
|
value={user}
|
||||||
></TextWithCopyButton>
|
></TextWithCopyButton>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -67,6 +67,8 @@ export const env = createEnv({
|
|||||||
.string()
|
.string()
|
||||||
.default("false")
|
.default("false")
|
||||||
.transform((str) => str === "true"),
|
.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_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
|
||||||
STRIPE_BASIC_PRICE_ID: process.env.STRIPE_BASIC_PRICE_ID,
|
STRIPE_BASIC_PRICE_ID: process.env.STRIPE_BASIC_PRICE_ID,
|
||||||
STRIPE_WEBHOOK_SECRET: process.env.STRIPE_WEBHOOK_SECRET,
|
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
|
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
||||||
|
@@ -62,6 +62,8 @@ services:
|
|||||||
- REDIS_URL=${REDIS_URL:?err}
|
- REDIS_URL=${REDIS_URL:?err}
|
||||||
- NEXT_PUBLIC_IS_CLOUD=${NEXT_PUBLIC_IS_CLOUD:-false}
|
- NEXT_PUBLIC_IS_CLOUD=${NEXT_PUBLIC_IS_CLOUD:-false}
|
||||||
- API_RATE_LIMIT=${API_RATE_LIMIT:-1}
|
- API_RATE_LIMIT=${API_RATE_LIMIT:-1}
|
||||||
|
- NEXT_PUBLIC_SMTP_HOST=${NEXT_PUBLIC_SMTP_HOST:-smtp.unsend.dev}
|
||||||
|
- NEXT_PUBLIC_SMTP_USER=${NEXT_PUBLIC_SMTP_USER:-unsend}
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
Reference in New Issue
Block a user