Resolve build errors
This commit is contained in:
+3
-3
@@ -2,9 +2,9 @@
|
||||
FROM node:24-slim AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Placeholder values ONLY so `vite build` doesn't crash on $env/static/*
|
||||
# imports during the build step. These are NOT the real runtime values —
|
||||
# App Platform injects the real ones as env vars when the container runs.
|
||||
# Placeholder values for build-time $env/static/* and better-auth's module-scope
|
||||
# secret validation. These are NOT the real runtime values — App Platform
|
||||
# injects the real ones as env vars when the container runs.
|
||||
ARG DATABASE_URL=postgres://placeholder:placeholder@localhost:5432/placeholder
|
||||
ARG ORIGIN=http://localhost:3000
|
||||
ARG BETTER_AUTH_URL=http://localhost:3000
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { BETTER_AUTH_URL } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { sendMail } from './resend';
|
||||
|
||||
export async function sendVerificationEmail(options: { email: string; token: string }) {
|
||||
const verificationUrl = `${BETTER_AUTH_URL}/api/auth/verify-email?token=${options.token}&callbackURL=/login?verified=true`;
|
||||
const verificationUrl = `${env.BETTER_AUTH_URL}/api/auth/verify-email?token=${options.token}&callbackURL=/login?verified=true`;
|
||||
|
||||
await sendMail({
|
||||
to: options.email,
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
*
|
||||
*/
|
||||
import { Resend } from 'resend';
|
||||
import { RESEND_API_KEY, EMAIL_FROM, RESEND_TEMPLATE_ID } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
export const resend = new Resend(RESEND_API_KEY);
|
||||
export const resend = new Resend(env.RESEND_API_KEY);
|
||||
|
||||
/**
|
||||
* Send a transactional email using a Resend-hosted template.
|
||||
@@ -39,11 +39,11 @@ export async function sendMail(options: {
|
||||
const { to, subject, templateId, data } = options;
|
||||
|
||||
const result = await resend.emails.send({
|
||||
from: EMAIL_FROM,
|
||||
from: env.EMAIL_FROM,
|
||||
to: [to],
|
||||
subject: subject ?? 'Template Email',
|
||||
template: {
|
||||
id: templateId ?? RESEND_TEMPLATE_ID,
|
||||
id: templateId ?? env.RESEND_TEMPLATE_ID,
|
||||
variables: data ?? {}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { json, error } from '@sveltejs/kit';
|
||||
import { auth } from '$lib/auth';
|
||||
import { prisma } from '$lib/db';
|
||||
import { sendMail } from '$lib/server/resend';
|
||||
import { BETTER_AUTH_URL } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
function generateLicenseKey(): string {
|
||||
const hex = crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase();
|
||||
@@ -53,8 +53,8 @@ export const POST: RequestHandler = async ({ request }) => {
|
||||
});
|
||||
|
||||
const verifyUrl = verification
|
||||
? `${BETTER_AUTH_URL}/api/auth/verify-email?token=${verification.value}&callbackURL=/login?verified=true`
|
||||
: `${BETTER_AUTH_URL}/login`;
|
||||
? `${env.BETTER_AUTH_URL}/api/auth/verify-email?token=${verification.value}&callbackURL=/login?verified=true`
|
||||
: `${env.BETTER_AUTH_URL}/login`;
|
||||
|
||||
await sendMail({
|
||||
to: email,
|
||||
@@ -64,7 +64,7 @@ export const POST: RequestHandler = async ({ request }) => {
|
||||
firstName: name ?? email.split('@')[0],
|
||||
tempPassword,
|
||||
verifyUrl,
|
||||
loginUrl: `${BETTER_AUTH_URL}/login`
|
||||
loginUrl: `${env.BETTER_AUTH_URL}/login`
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user