mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
block config updates if one is already in progress
This commit is contained in:
4
api.go
4
api.go
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user