|
|
@@ -5,8 +5,8 @@ import { UnauthorizedError, AppError } from './errorHandler';
|
|
|
import { JwtPayload } from '../types';
|
|
|
|
|
|
export async function authMiddleware(ctx: Context, next: Next): Promise<void> {
|
|
|
- // 开发阶段跳过认证(CLAUDE.md 要求 auth_enabled: false)
|
|
|
- const authEnabled = process.env.AUTH_ENABLED !== 'false';
|
|
|
+ // 开发阶段默认跳过认证(除非显式设置 AUTH_ENABLED=true)
|
|
|
+ const authEnabled = process.env.AUTH_ENABLED === 'true';
|
|
|
if (!authEnabled) {
|
|
|
ctx.state.user = {
|
|
|
userId: '1',
|