MCPcopy Create free account
hub / github.com/netlify/gotrue / UpdateInstance

Method UpdateInstance

api/instance.go:103–120  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

101}
102
103func (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(&params); 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
122func (a *API) DeleteInstance(w http.ResponseWriter, r *http.Request) error {
123 i := getInstance(r.Context())

Callers

nothing calls this directly

Calls 6

getInstanceFunction · 0.85
badRequestErrorFunction · 0.85
internalServerErrorFunction · 0.85
sendJSONFunction · 0.85
UpdateConfigMethod · 0.80
WithInternalErrorMethod · 0.45

Tested by

no test coverage detected