Skip to content

Commit 54f0356

Browse files
authored
Add GitHub PAT support to code space management modal (#2692)
1 parent 5f47c4e commit 54f0356

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

db/structs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,8 @@ type CodeSpaceMap struct {
16001600
WorkspaceID string `json:"workspaceID" gorm:"index"`
16011601
CodeSpaceURL string `json:"codeSpaceURL"`
16021602
UserPubkey string `json:"userPubkey" gorm:"index"`
1603+
// TODO: Encrypt this field
1604+
GithubPat string `json:"githubPat,omitempty" gorm:"column:github_pat"`
16031605
}
16041606

16051607
type StakeStatus string

handlers/codespace.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ func (ch *codeSpaceHandler) UpdateCodeSpaceMap(w http.ResponseWriter, r *http.Re
358358
if codeSpace.UserPubkey != "" {
359359
updates["user_pubkey"] = codeSpace.UserPubkey
360360
}
361+
// Also allow updating GithubPat, even if empty to clear it
362+
updates["github_pat"] = codeSpace.GithubPat
363+
361364

362365
updatedCodeSpace, err := ch.db.UpdateCodeSpaceMap(id, updates)
363366
if err != nil {

0 commit comments

Comments
 (0)