feat: add env setup wizard, fix docker-compose env passthrough and email from field
- Add interactive setup wizard (scripts/setup-env.js) with SQLite/PostgreSQL
choice, AI provider config, email, MCP, admin account creation, and
auto-switch of Prisma schema provider
- Fix docker-compose.yml: remove duplicate environment entries that overrode
env_file values with empty strings (broke AI providers in Docker). Now only
DATABASE_URL, NODE_ENV, NEXT_TELEMETRY_DISABLED remain in environment:
- Fix revalidateTag('system-config', '/settings') crash: Next.js 16 interprets
the second arg as a cacheLife profile, not a path. Caused 500 on all admin
settings saves
- Fix Resend "from" field: was building noreply@localhost which Resend rejects.
Now uses SMTP_FROM from config, with localhost-aware fallback
- Add debug logging for auto-labeling background task
- Default DATABASE_URL changed from user:password to memento:memento
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -61,9 +61,24 @@ async function sendViaResend(apiKey: string, { to, subject, html, attachments }:
|
||||
const { Resend } = await import('resend');
|
||||
const resend = new Resend(apiKey);
|
||||
|
||||
const from = process.env.NEXTAUTH_URL
|
||||
? `Memento <noreply@${new URL(process.env.NEXTAUTH_URL).hostname}>`
|
||||
: 'Memento <onboarding@resend.dev>';
|
||||
// Build a valid "from" address for Resend
|
||||
// Priority: SMTP_FROM from DB config > env var > derived from NEXTAUTH_URL > Resend default
|
||||
const config = await getSystemConfig();
|
||||
const smtpFrom = config.SMTP_FROM || process.env.SMTP_FROM;
|
||||
let from: string;
|
||||
if (smtpFrom) {
|
||||
from = smtpFrom.includes('<') ? smtpFrom : `Memento <${smtpFrom}>`;
|
||||
} else if (process.env.NEXTAUTH_URL) {
|
||||
const hostname = new URL(process.env.NEXTAUTH_URL).hostname;
|
||||
// Only use hostname-based from if it's not localhost (Resend rejects it)
|
||||
if (hostname !== 'localhost') {
|
||||
from = `Memento <noreply@${hostname}>`;
|
||||
} else {
|
||||
from = 'Memento <onboarding@resend.dev>';
|
||||
}
|
||||
} else {
|
||||
from = 'Memento <onboarding@resend.dev>';
|
||||
}
|
||||
|
||||
// Resend supports attachments with inline content
|
||||
const resendAttachments = attachments?.map(att => ({
|
||||
|
||||
Reference in New Issue
Block a user