Skip to content

Commit 47e6af6

Browse files
Fix ValueKeyID null value handling in user secrets
Set ValueKeyID to proper sql.NullString{Valid: false} instead of empty struct to correctly represent NULL in database when no encryption is used. Co-authored-by: mattvollmer <95866673+mattvollmer@users.noreply.github.com>
1 parent 000781a commit 47e6af6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

coderd/user_secrets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (api *API) createUserSecret(rw http.ResponseWriter, r *http.Request) {
3939
Name: req.Name,
4040
Description: req.Description,
4141
Value: req.Value,
42-
ValueKeyID: sql.NullString{}, // Add missing field
42+
ValueKeyID: sql.NullString{Valid: false}, // NULL since no encryption
4343
})
4444
if err != nil {
4545
httpapi.InternalServerError(rw, err)

0 commit comments

Comments
 (0)