1.4 KiB
Admin User Seeding Guide
This document explains how to manage the default admin user in the GAuth-Central application.
Overview
Previously, the default admin user was created automatically every time the application started. This behavior has been changed to prevent accidental recreation or resetting of the admin user in production environments.
Now, the default admin user is only created when you explicitly run the seeding command.
How to Seed the Admin User
To create the default admin user, run the application with the seed-admin argument:
go run main.go seed-admin
Or if you have built the binary:
./gauth-central seed-admin
What this command does:
- Checks if a user with email
admin@gauth.localexists (including soft-deleted users). - If not found: Creates a new user with default credentials.
- If found but deleted: Restores the user (sets
deleted_atto NULL). - Ensures the user has the
adminrole assigned.
Default Credentials
- Email:
admin@gauth.local - Password:
Admin@123
⚠️ Security Warning: Please change this password immediately after your first login!
Running the Server Normally
To run the server without seeding the admin user (normal operation):
go run main.go
The application will connect to the database and run migrations, but it will not attempt to create or modify the default admin user.