备份:修复前完整项目快照 2026-04-19
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
const fs = require('fs');
|
||||
const content = fs.readFileSync('middleware/auth.js', 'utf8');
|
||||
|
||||
// 修复JWT_SECRET,使其与utils/auth.js中的一致
|
||||
const fixedContent = content
|
||||
.replace(
|
||||
"const JWT_SECRET = process.env.JWT_SECRET || 'your-secret-key-change-in-production';",
|
||||
"const JWT_SECRET = process.env.JWT_SECRET || 'your-jwt-secret-change-in-production';"
|
||||
);
|
||||
|
||||
// 写入修复后的文件
|
||||
fs.writeFileSync('middleware/auth.js', fixedContent);
|
||||
console.log('✅ 已修复middleware/auth.js中的JWT_SECRET');
|
||||
|
||||
// 验证修复
|
||||
const fixedFileContent = fs.readFileSync('middleware/auth.js', 'utf8');
|
||||
if (fixedFileContent.includes("'your-jwt-secret-change-in-production'")) {
|
||||
console.log('✅ JWT_SECRET修复验证成功');
|
||||
} else {
|
||||
console.log('❌ JWT_SECRET修复验证失败');
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user