Skip to content

feat: make default user role configurable via GOTRUE_DB_DEFAULT_ROLE#2420

Open
nancysangani wants to merge 1 commit intosupabase:masterfrom
nancysangani:feat/configurable-default-role
Open

feat: make default user role configurable via GOTRUE_DB_DEFAULT_ROLE#2420
nancysangani wants to merge 1 commit intosupabase:masterfrom
nancysangani:feat/configurable-default-role

Conversation

@nancysangani
Copy link

What kind of change does this PR introduce?

Bug fix + feature

What is the current behavior?

Default role for new users is tied to the deprecated GOTRUE_JWT_DEFAULT_GROUP_NAME. If not set, users get an empty role, causing issues on redeployment.
Fixes #2359

What is the new behavior?

New env var GOTRUE_DB_DEFAULT_ROLE lets you configure the default role. Falls back to "authenticated" if not set. GOTRUE_JWT_DEFAULT_GROUP_NAME still works with a deprecation warning.

@nancysangani nancysangani requested a review from a team as a code owner March 12, 2026 12:58
Copilot AI review requested due to automatic review settings March 12, 2026 12:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new GOTRUE_DB_DEFAULT_ROLE environment variable to configure the default user role, replacing the deprecated GOTRUE_JWT_DEFAULT_GROUP_NAME. Falls back to "authenticated" if neither is set.

Changes:

  • Added DefaultRole field to DBConfiguration and fallback logic in ApplyDefaults
  • Updated signupNewUser and adminUserCreate to use config.DB.DefaultRole
  • Improved deprecation warning for GOTRUE_JWT_DEFAULT_GROUP_NAME

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/conf/configuration.go New DefaultRole field and fallback logic in ApplyDefaults
internal/api/signup.go Use config.DB.DefaultRole instead of config.JWT.DefaultGroupName
internal/api/admin.go Use config.DB.DefaultRole instead of config.JWT.DefaultGroupName
internal/api/api.go Updated deprecation warning message

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@nancysangani
Copy link
Author

/cc @fadymak
/cc @staaldraad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make default role configurable instead of hardcoded

2 participants