feat: make default user role configurable via GOTRUE_DB_DEFAULT_ROLE#2420
feat: make default user role configurable via GOTRUE_DB_DEFAULT_ROLE#2420nancysangani 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.
|
/cc @fadymak |
|
/cc @cemalkilic |
|
Please see our https://github.com/supabase/auth/blob/master/CONTRIBUTING.md |
|
Hi @cstockton! I've addressed the feedback from this PR by adding proper tests and refining the implementation based on the contributing guidelines. |
|
@nancysangani I would start by opening issues to discuss if these features will be accepted by the team. Some of them would require platform changes on our side that we might not be willing to commit to. |
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.