block config updates if one is already in progress

This commit is contained in:
Joel Wetzell
2026-03-21 11:32:11 -05:00
parent 012c416432
commit 1cdfe929b4
2 changed files with 10 additions and 0 deletions

4
api.go
View File

@@ -85,6 +85,10 @@ func (r *Router) handleConfigHTTP(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write(configJSON)
case http.MethodPut:
if r.updatingConfig {
http.Error(w, "Config update in progress.", http.StatusConflict)
return
}
var newConfig config.Config
err := json.NewDecoder(req.Body).Decode(&newConfig)
if err != nil {