ability to update a repo's public / private key via the REST API
This commit is contained in:
parent
617476784d
commit
96e660381f
1 changed files with 6 additions and 0 deletions
|
@ -170,6 +170,8 @@ func (h *RepoHandler) PutRepo(w http.ResponseWriter, r *http.Request) error {
|
||||||
Privileged *bool `json:"privileged"`
|
Privileged *bool `json:"privileged"`
|
||||||
Params *string `json:"params"`
|
Params *string `json:"params"`
|
||||||
Timeout *int64 `json:"timeout"`
|
Timeout *int64 `json:"timeout"`
|
||||||
|
PublicKey *string `json:"public_key"`
|
||||||
|
PrivateKey *string `json:"private_key"`
|
||||||
}{}
|
}{}
|
||||||
if err := json.NewDecoder(r.Body).Decode(&in); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&in); err != nil {
|
||||||
return badRequest{err}
|
return badRequest{err}
|
||||||
|
@ -197,6 +199,10 @@ func (h *RepoHandler) PutRepo(w http.ResponseWriter, r *http.Request) error {
|
||||||
if in.Timeout != nil && user.Admin {
|
if in.Timeout != nil && user.Admin {
|
||||||
repo.Timeout = *in.Timeout
|
repo.Timeout = *in.Timeout
|
||||||
}
|
}
|
||||||
|
if in.PrivateKey != nil && in.PublicKey != nil {
|
||||||
|
repo.PublicKey = *in.PublicKey
|
||||||
|
repo.PrivateKey = *in.PrivateKey
|
||||||
|
}
|
||||||
|
|
||||||
// update the repository
|
// update the repository
|
||||||
if err := h.repos.Update(repo); err != nil {
|
if err := h.repos.Update(repo); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue