Einstellungen-Seite: .env-Werte in DB (app_state), keine .env mehr
Neue /einstellungen-Seite (Zahnrad im Header) mit allen bisherigen .env-Werten (Ollama, E-Mail, CalDAV, REST-API), gespeichert in SQLite (app_state, cfg:-Prefix). Libs lesen per lib/config.js zur Laufzeit statt beim Start -> Aenderungen wirken sofort, kein Neustart. Bestehende .env wird beim ersten Start einmalig migriert. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+11
-8
@@ -11,18 +11,21 @@
|
||||
const nodemailer = require('nodemailer');
|
||||
const { ImapFlow } = require('imapflow');
|
||||
const { simpleParser } = require('mailparser');
|
||||
const config = require('./config');
|
||||
|
||||
// Read fresh on every call so an edit on the /einstellungen page takes effect
|
||||
// immediately (values live in the DB now, not in process.env/.env).
|
||||
function cfg() {
|
||||
const smtpPort = Number(process.env.MAIL_SMTP_PORT || 587);
|
||||
const smtpPort = Number(config.get('MAIL_SMTP_PORT') || 587);
|
||||
return {
|
||||
host: process.env.MAIL_HOST || '',
|
||||
host: config.get('MAIL_HOST') || '',
|
||||
smtpPort,
|
||||
imapPort: Number(process.env.MAIL_IMAP_PORT || 993),
|
||||
user: process.env.MAIL_USER || '',
|
||||
pass: process.env.MAIL_PASSWORD || '',
|
||||
fromName: process.env.MAIL_FROM_NAME || '',
|
||||
fromAddr: process.env.MAIL_FROM || process.env.MAIL_USER || '',
|
||||
mailbox: process.env.MAIL_IMAP_MAILBOX || 'INBOX',
|
||||
imapPort: Number(config.get('MAIL_IMAP_PORT') || 993),
|
||||
user: config.get('MAIL_USER') || '',
|
||||
pass: config.get('MAIL_PASSWORD') || '',
|
||||
fromName: config.get('MAIL_FROM_NAME') || '',
|
||||
fromAddr: config.get('MAIL_FROM') || config.get('MAIL_USER') || '',
|
||||
mailbox: config.get('MAIL_IMAP_MAILBOX') || 'INBOX',
|
||||
// secure=true means implicit TLS (465); 587 uses STARTTLS (requireTLS).
|
||||
smtpSecure: smtpPort === 465,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user