mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2025-12-15 10:34:43 -05:00
feat: introduce BETTER_AUTH_URL and NEXT_PUBLIC_APP_URL environment variables and update password reset link.
This commit is contained in:
37
.env.example
37
.env.example
@@ -1,27 +1,32 @@
|
|||||||
# Base application env (example)
|
# Base application env
|
||||||
NODE_ENV=production
|
NODE_ENV="development"
|
||||||
PORT=3000
|
PORT="3000"
|
||||||
HOSTNAME=0.0.0.0
|
HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
# NextAuth
|
# Auth
|
||||||
AUTH_SECRET=replace-with-strong-secret
|
# You can generate a new secret on the command line with:
|
||||||
|
# openssl rand -base64 32
|
||||||
|
AUTH_SECRET="your-auth-secret"
|
||||||
|
BETTER_AUTH_URL="http://localhost:3000" # Set to your production URL in production
|
||||||
|
|
||||||
|
# App URL
|
||||||
|
# Used for client-side redirects and base URLs
|
||||||
|
NEXT_PUBLIC_APP_URL="http://localhost:3000"
|
||||||
|
|
||||||
# Database (Postgres)
|
# Database (Postgres)
|
||||||
# These are required for Docker container initialization
|
# These are required for Docker container initialization
|
||||||
POSTGRES_USER=beenvoice
|
POSTGRES_USER="postgres"
|
||||||
POSTGRES_PASSWORD=beenvoice
|
POSTGRES_PASSWORD="postgres"
|
||||||
POSTGRES_DB=beenvoice
|
POSTGRES_DB="postgres"
|
||||||
|
|
||||||
# Connect string for the app
|
# Connect string for the app
|
||||||
DATABASE_URL=postgres://beenvoice:beenvoice@db:5432/beenvoice
|
DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres"
|
||||||
# Disable SSL for Docker local Postgres; set to false or remove for managed Postgres
|
# Disable SSL for Docker local Postgres; set to false or remove for managed Postgres
|
||||||
DB_DISABLE_SSL=true
|
DB_DISABLE_SSL="true"
|
||||||
|
|
||||||
# Email (Resend). Replace with real keys in production
|
# Email (Resend). Replace with real keys in production
|
||||||
RESEND_API_KEY=replace-or-remove
|
RESEND_API_KEY="your-resend-api-key"
|
||||||
RESEND_DOMAIN=
|
RESEND_DOMAIN=""
|
||||||
|
|
||||||
# Build tweaks
|
# Build tweaks
|
||||||
SKIP_ENV_VALIDATION=1
|
# SKIP_ENV_VALIDATION=1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export async function POST(request: NextRequest) {
|
|||||||
// Send password reset email using Resend
|
// Send password reset email using Resend
|
||||||
try {
|
try {
|
||||||
const resend = new Resend(env.RESEND_API_KEY);
|
const resend = new Resend(env.RESEND_API_KEY);
|
||||||
const resetUrl = `${process.env.NEXTAUTH_URL ?? "http://localhost:3000"}/auth/reset-password?token=${resetToken}`;
|
const resetUrl = `${process.env.BETTER_AUTH_URL ?? "http://localhost:3000"}/auth/reset-password?token=${resetToken}`;
|
||||||
|
|
||||||
const emailTemplate = generatePasswordResetEmailTemplate({
|
const emailTemplate = generatePasswordResetEmailTemplate({
|
||||||
userEmail: email,
|
userEmail: email,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const env = createEnv({
|
|||||||
? z.string()
|
? z.string()
|
||||||
: z.string().optional(),
|
: z.string().optional(),
|
||||||
DATABASE_URL: z.string().url(),
|
DATABASE_URL: z.string().url(),
|
||||||
|
BETTER_AUTH_URL: z.string().url().optional(),
|
||||||
RESEND_API_KEY:
|
RESEND_API_KEY:
|
||||||
process.env.NODE_ENV === "production"
|
process.env.NODE_ENV === "production"
|
||||||
? z.string().min(1)
|
? z.string().min(1)
|
||||||
@@ -29,7 +30,7 @@ export const env = createEnv({
|
|||||||
* `NEXT_PUBLIC_`.
|
* `NEXT_PUBLIC_`.
|
||||||
*/
|
*/
|
||||||
client: {
|
client: {
|
||||||
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
NEXT_PUBLIC_APP_URL: z.string().url().optional(),
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,10 +40,12 @@ export const env = createEnv({
|
|||||||
runtimeEnv: {
|
runtimeEnv: {
|
||||||
AUTH_SECRET: process.env.AUTH_SECRET,
|
AUTH_SECRET: process.env.AUTH_SECRET,
|
||||||
DATABASE_URL: process.env.DATABASE_URL,
|
DATABASE_URL: process.env.DATABASE_URL,
|
||||||
|
BETTER_AUTH_URL: process.env.BETTER_AUTH_URL,
|
||||||
RESEND_API_KEY: process.env.RESEND_API_KEY,
|
RESEND_API_KEY: process.env.RESEND_API_KEY,
|
||||||
RESEND_DOMAIN: process.env.RESEND_DOMAIN,
|
RESEND_DOMAIN: process.env.RESEND_DOMAIN,
|
||||||
NODE_ENV: process.env.NODE_ENV,
|
NODE_ENV: process.env.NODE_ENV,
|
||||||
DB_DISABLE_SSL: process.env.DB_DISABLE_SSL,
|
DB_DISABLE_SSL: process.env.DB_DISABLE_SSL,
|
||||||
|
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
|||||||
Reference in New Issue
Block a user