Refactor JWT_SECRET handling and add setup warning page

This commit is contained in:
shuaiplus committed 2026-02-08 21:27:13 +08:00
1 parent f13ba90ebe
commit 5fc2436552
12 files changed
+1024 -780

No files matched your search

+2 -11
View File
@@ -3,16 +3,7 @@ import { handleRequest } from './router';
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
// Security check: JWT_SECRET must be set
if (!env.JWT_SECRET) {
return new Response('Server configuration error: JWT_SECRET is not set', { status: 500 });
}
// Security check: warn if JWT_SECRET is too weak
if (env.JWT_SECRET.length < 32) {
console.warn('[SECURITY WARNING] JWT_SECRET should be at least 32 characters for adequate security');
}
return handleRequest(request, env);
return handleRequest(request, env);
},
};