Files
AuthCentral/ADMIN_SEEDING.md
Beyhan Oğur 8b1fbdee99 first commit
2026-04-26 21:37:58 +03:00

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:

  1. Checks if a user with email admin@gauth.local exists (including soft-deleted users).
  2. If not found: Creates a new user with default credentials.
  3. If found but deleted: Restores the user (sets deleted_at to NULL).
  4. Ensures the user has the admin role 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.