mirror of
https://github.com/andrey271192/Domain_web.git
synced 2026-09-20 14:41:58 +00:00
Add background DNS/SSL monitor checks, registration API, smoother SSE with stage labels, improved CDN/WAF detection, light-theme UI polish, and README roadmap updates. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
781 B
TypeScript
29 lines
781 B
TypeScript
import bcrypt from "bcryptjs";
|
|
import { PrismaClient } from "@prisma/client";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const email = process.env.SEED_ADMIN_EMAIL?.toLowerCase();
|
|
const password = process.env.SEED_ADMIN_PASSWORD;
|
|
if (!email || !password) {
|
|
console.log("[seed-admin] SEED_ADMIN_EMAIL / SEED_ADMIN_PASSWORD not set — skip");
|
|
return;
|
|
}
|
|
|
|
const passwordHash = await bcrypt.hash(password, 12);
|
|
await prisma.user.upsert({
|
|
where: { email },
|
|
create: { email, passwordHash, role: "ADMIN", name: "Admin" },
|
|
update: { passwordHash, role: "ADMIN" },
|
|
});
|
|
console.log(`[seed-admin] admin ready: ${email}`);
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => prisma.$disconnect());
|