@@ -334,7 +334,12 @@ async function main() {
334334 }
335335
336336 const adminEmail = envAdminEmail ?? 'admin@neon.example' ;
337- const adminPassword = envAdminPassword ?? 'Admin123!' ;
337+ const adminPassword = envAdminPassword ;
338+
339+ if ( ! adminPassword ) {
340+ throw new Error ( 'RBAC_ADMIN_PASSWORD environment variable must be set before seeding' ) ;
341+ }
342+
338343 const hashed = await bcrypt . hash ( adminPassword , 10 ) ;
339344
340345 const adminUser = await prisma . user . upsert ( {
@@ -360,7 +365,12 @@ async function main() {
360365 { email : 'labtech@example.com' , name : 'Rita Patel' , role : 'LAB_TECH' } ,
361366 ] ;
362367
363- const testPassword = 'Test123!' ;
368+ const testPassword = process . env . RBAC_TEST_PASSWORD ;
369+
370+ if ( ! testPassword ) {
371+ throw new Error ( 'RBAC_TEST_PASSWORD environment variable must be set before seeding' ) ;
372+ }
373+
364374 const testHashedPassword = await bcrypt . hash ( testPassword , 10 ) ;
365375
366376 console . log ( '📝 Creating/Updating test users with roles...' ) ;
@@ -413,7 +423,7 @@ async function main() {
413423 create : {
414424 email : docData . email ,
415425 name : docData . name ,
416- password : await bcrypt . hash ( 'password123 ', 10 ) ,
426+ password : await bcrypt . hash ( process . env . RBAC_DOCTOR_PASSWORD || 'temp ', 10 ) ,
417427 role : 'DOCTOR' as unknown as any ,
418428 roleEntityId : doctorRole ?. id ,
419429 } ,
@@ -448,16 +458,10 @@ async function main() {
448458 console . log ( `║ ${ summary } ` . padEnd ( 62 ) + '║' ) ;
449459 }
450460 console . log ( '╠════════════════════════════════════════════════════════════╣' ) ;
451- if ( ! isProdLike ) {
452- console . log ( `║ 🔐 Admin Credentials: ║` ) ;
453- console . log ( `║ Email: ${ adminEmail } ` . padEnd ( 62 ) + '║' ) ;
454- console . log ( `║ Password: ${ adminPassword } ` . padEnd ( 62 ) + '║' ) ;
455- console . log ( '║ 🔐 Test User Credentials (all roles): ║' ) ;
456- console . log ( `║ Password: Test123! (for all test users) ║` ) ;
457- console . log ( '║ ⚠️ CHANGE credentials before production deployment ║' ) ;
458- } else {
459- console . log ( '║ ✓ Production mode - passwords not displayed ║' ) ;
460- }
461+ console . log ( '║ ⚠️ IMPORTANT: Set these environment variables before seeding:║' ) ;
462+ console . log ( '║ - RBAC_ADMIN_PASSWORD ║' ) ;
463+ console . log ( '║ - RBAC_TEST_PASSWORD ║' ) ;
464+ console . log ( '║ - RBAC_DOCTOR_PASSWORD ║' ) ;
461465 console . log ( '╚════════════════════════════════════════════════════════════╝\n' ) ;
462466}
463467
0 commit comments