(w http.ResponseWriter, r *http.Request)
| 101 | } |
| 102 | |
| 103 | func (a *API) UpdateInstance(w http.ResponseWriter, r *http.Request) error { |
| 104 | i := getInstance(r.Context()) |
| 105 | |
| 106 | params := InstanceRequestParams{BaseConfig: i.BaseConfig} |
| 107 | if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil { |
| 108 | return badRequestError("Error decoding params: %v", err) |
| 109 | } |
| 110 | |
| 111 | if err := i.UpdateConfig(a.db, params.BaseConfig); err != nil { |
| 112 | return internalServerError("Database error updating instance").WithInternalError(err) |
| 113 | } |
| 114 | |
| 115 | // Hide SMTP credential from response |
| 116 | if i.BaseConfig != nil { |
| 117 | i.BaseConfig.SMTP.Pass = "" |
| 118 | } |
| 119 | return sendJSON(w, http.StatusOK, i) |
| 120 | } |
| 121 | |
| 122 | func (a *API) DeleteInstance(w http.ResponseWriter, r *http.Request) error { |
| 123 | i := getInstance(r.Context()) |
nothing calls this directly
no test coverage detected