mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
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"`
|
||||
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}
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue