refactor(server): remove bootstrap admin path #34
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Removes the env-driven
auth.Bootstrap()path that creates an "admin" user on first start with a stderr-printed password. With self-registration shipped (#376), the first user to register on a fresh instance becomes admin viaCreateUserFirstAdminRace, so the bootstrap path is just a second source of truth that confuses operators and leaves an account in the DB nobody asked for.Removed
internal/auth/bootstrap.go+ its testauth.Bootstrap()call fromcmd/minstrel/main.goAuthConfig+AdminBootstrapConfigstructs frominternal/configMINSTREL_AUTH_ADMIN_USERNAME/MINSTREL_AUTH_ADMIN_PASSWORDenv reads + their testauth:block fromconfig.example.yamldocker-compose.ymland the READMENew first-run flow
docker compose uphttp://<host>/registerThe README quickstart text updated to reflect this.
Migration for existing instances
Operator stood the prod DB down for a fresh start, so this PR has no migration path baked in. For any future operator who upgrades with a bootstrap-admin row already in place: log in as the bootstrap admin, generate an invite from
/admin/users, register a new admin via/registerwith that token, promote them, then delete the bootstrap account (last-admin guard requires the new admin to be promoted first).Recovery story
Forgotten admin password on a single-admin instance is now only recoverable via Fable #321 (admin password reset CLI), which doesn't ship yet. Worth scheduling soon. Not blocking on this PR — the bootstrap path didn't help with forgotten passwords either (it only fired when users table was empty).
Default registration mode
Unchanged:
registration_settings.modestill defaults toinvite_onlyper migration0022_user_management. After the operator registers as user #1, additional users need an invite token (generated via the new/admin/usersInvites section). No UI yet for switching modes — filing as a small follow-up.Test plan
CI runs Go tests + container build + Flutter checks.
/register, register user #1, confirmis_admin = true/admin/users, generate an invite, register a friend with that token, confirm friend lands as non-adminMINSTREL_AUTH_ADMIN_*env var noise in logs / docker-compose / README