feat: 自动生成JWT_SECRET和ADMIN_PASSWORD并持久化到secrets.json

This commit is contained in:
2026-05-18 16:48:04 +08:00
parent 86d79e550b
commit c57af012b1
3 changed files with 77 additions and 13 deletions

View File

@@ -42,14 +42,7 @@ export function validateConfig(): ValidationError[] {
}
// ─── Cookie Encryption ───
if (!process.env.COOKIE_ENCRYPTION_KEY) {
errors.push({
key: 'COOKIE_ENCRYPTION_KEY',
message: '未设置网盘 Cookie 加密密钥Cookie 将以明文存储。生产环境强烈建议设置。\n' +
'生成: openssl rand -hex 32',
severity: 'warn',
});
}
// Key is auto-generated and persisted to encryption.key if COOKIE_ENCRYPTION_KEY is not set
// ─── Port conflict check (best-effort) ───
if (config.port < 1024 && (process as any).getuid?.() !== 0) {