feat: 打通 Jenkins 直构导入闭环
This commit is contained in:
@@ -13,9 +13,19 @@ const prisma = new PrismaClient();
|
||||
const passwordService = new PasswordService();
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const password = process.env.SUPER_ADMIN_RESET_PASSWORD?.trim()
|
||||
? process.env.SUPER_ADMIN_RESET_PASSWORD.trim()
|
||||
: SUPER_ADMIN_INITIAL_PASSWORD;
|
||||
const configuredPassword = process.env.SUPER_ADMIN_RESET_PASSWORD?.trim();
|
||||
const password =
|
||||
configuredPassword ||
|
||||
(process.env.NODE_ENV === 'production'
|
||||
? undefined
|
||||
: SUPER_ADMIN_INITIAL_PASSWORD);
|
||||
|
||||
if (!password) {
|
||||
throw new Error(
|
||||
'生产环境缺少 SUPER_ADMIN_RESET_PASSWORD,不能使用公开默认密码重置超级管理员',
|
||||
);
|
||||
}
|
||||
|
||||
const passwordHash = await passwordService.hashPassword(password);
|
||||
|
||||
await prisma.user.upsert({
|
||||
|
||||
Reference in New Issue
Block a user