feat: make default user role configurable via GOTRUE_DB_DEFAULT_ROLE#2420
Open
nancysangani wants to merge 1 commit intosupabase:masterfrom
Open
feat: make default user role configurable via GOTRUE_DB_DEFAULT_ROLE#2420nancysangani wants to merge 1 commit intosupabase:masterfrom
nancysangani wants to merge 1 commit intosupabase:masterfrom
Conversation
There was a problem hiding this comment.
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
DefaultRolefield toDBConfigurationand fallback logic inApplyDefaults - Updated
signupNewUserandadminUserCreateto useconfig.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.
Author
|
/cc @fadymak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.