-
Notifications
You must be signed in to change notification settings - Fork 928
feat: add name field to setup screen + CLI #13491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
22335c7
64af358
31313bc
2805571
a62a8ee
ec1befd
e80f4c8
c3849be
7cf406d
ca2bafa
3eadba7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ OPTIONS: | |
Specifies an email address to use if creating the first user for the | ||
deployment. | ||
|
||
--first-user-full-name string, $CODER_FIRST_USER_FULL_NAME | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I think we should use "name" instead of "full name" since it is uncommon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I originally used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see.... 👍 |
||
Specifies a human-readable name for the first user of the deployment. | ||
|
||
--first-user-password string, $CODER_FIRST_USER_PASSWORD | ||
Specifies a password to use if creating the first user for the | ||
deployment. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ import ( | |
"github.com/google/uuid" | ||
"golang.org/x/xerrors" | ||
|
||
"cdr.dev/slog" | ||
|
||
"github.com/coder/coder/v2/coderd/audit" | ||
"github.com/coder/coder/v2/coderd/database" | ||
"github.com/coder/coder/v2/coderd/database/db2sdk" | ||
|
@@ -200,6 +202,19 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) { | |
return | ||
} | ||
|
||
//nolint:gocritic // Needed to create first user. | ||
if _, err := api.Database.UpdateUserProfile(dbauthz.AsSystemRestricted(ctx), database.UpdateUserProfileParams{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to run a separate query to update the name? In my head, it would be done in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you mean; there is no such query There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't see a good reason to create a user without the name and after, update it. IMO, it should be a single operation. |
||
ID: user.ID, | ||
UpdatedAt: dbtime.Now(), | ||
Email: user.Email, | ||
Username: user.Username, | ||
AvatarURL: user.AvatarURL, | ||
Name: createUser.FullName, | ||
}); err != nil { | ||
// This should not be a fatal error. Updating the user's profile can be done separately. | ||
api.Logger.Error(ctx, "failed to update userprofile.Name", slog.Error(err)) | ||
} | ||
|
||
if api.RefreshEntitlements != nil { | ||
err = api.RefreshEntitlements(ctx) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: one error handling block has less chance of being disconnected in future.