Skip to content

Commit

Permalink
ability to update a repo's public / private key via the REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Sep 6, 2014
1 parent 6174767 commit 96e6603
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/handler/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ func (h *RepoHandler) PutRepo(w http.ResponseWriter, r *http.Request) error {
Privileged *bool `json:"privileged"`
Params *string `json:"params"`
Timeout *int64 `json:"timeout"`
PublicKey *string `json:"public_key"`
PrivateKey *string `json:"private_key"`
}{}
if err := json.NewDecoder(r.Body).Decode(&in); err != nil {
return badRequest{err}
Expand Down Expand Up @@ -197,6 +199,10 @@ func (h *RepoHandler) PutRepo(w http.ResponseWriter, r *http.Request) error {
if in.Timeout != nil && user.Admin {
repo.Timeout = *in.Timeout
}
if in.PrivateKey != nil && in.PublicKey != nil {
repo.PublicKey = *in.PublicKey
repo.PrivateKey = *in.PrivateKey
}

// update the repository
if err := h.repos.Update(repo); err != nil {
Expand Down

0 comments on commit 96e6603

Please sign in to comment.