48 lines
1.2 KiB
Markdown
48 lines
1.2 KiB
Markdown
Add the necessary environment variables to your `.env` file:
|
|
|
|
```env
|
|
# Default Admin Configuration
|
|
DEFAULT_ADMIN_EMAIL=admin@imk.com
|
|
DEFAULT_ADMIN_PASSWORD=admin123456
|
|
DEFAULT_ADMIN_NAME=System Admin
|
|
```
|
|
|
|
To use this setup:
|
|
|
|
1. The seed script will run automatically during deployment when you run:
|
|
```bash
|
|
npx prisma db push
|
|
npx prisma db seed
|
|
```
|
|
|
|
2. Alternatively, you can manually trigger the initialization by making a POST request to:
|
|
```
|
|
POST /init/system
|
|
```
|
|
|
|
This gives you two ways to ensure the default admin user is created:
|
|
1. Automatically during deployment via the seed script
|
|
2. Manually via the initialization endpoint
|
|
|
|
To deploy, you would:
|
|
|
|
1. Set up your environment variables
|
|
2. Run the database migrations
|
|
3. Run the seed script
|
|
```bash
|
|
npm run prisma:deploy
|
|
npm run prisma:seed
|
|
```
|
|
|
|
The default admin credentials will be:
|
|
- Email: admin@imk.com (or whatever you set in env)
|
|
- Password: admin123456 (or whatever you set in env)
|
|
|
|
Make sure to:
|
|
1. Change the default password after first login
|
|
2. Use strong passwords in production
|
|
3. Properly secure the initialization endpoint in production
|
|
4. Keep your environment variables secure
|
|
|
|
This setup ensures you always have an admin user available after deployment while maintaining security and flexibility.
|