feat(seed): require ADMIN_INITIAL_PASSWORD + convert setup-db to ESM (drop-public-setup) #13
1 changed files with 4 additions and 3 deletions
|
|
@ -8,9 +8,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Load environment variables from .env.local
|
// Load environment variables from .env.local
|
||||||
require('dotenv').config({ path: '.env.local' });
|
import dotenv from 'dotenv';
|
||||||
|
dotenv.config({ path: '.env.local' });
|
||||||
|
|
||||||
const { neon } = require('@neondatabase/serverless');
|
import { neon } from '@neondatabase/serverless';
|
||||||
|
import bcrypt from 'bcryptjs';
|
||||||
|
|
||||||
async function setupNeonDatabase() {
|
async function setupNeonDatabase() {
|
||||||
const adminPassword = process.env.ADMIN_INITIAL_PASSWORD;
|
const adminPassword = process.env.ADMIN_INITIAL_PASSWORD;
|
||||||
|
|
@ -139,7 +141,6 @@ async function setupNeonDatabase() {
|
||||||
console.log('✅ Created deck_cards table');
|
console.log('✅ Created deck_cards table');
|
||||||
|
|
||||||
// Create admin user
|
// Create admin user
|
||||||
const bcrypt = require('bcryptjs');
|
|
||||||
const hashedPassword = await bcrypt.hash(adminPassword, 12);
|
const hashedPassword = await bcrypt.hash(adminPassword, 12);
|
||||||
|
|
||||||
await sql`
|
await sql`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue