+func configHandler(w http.ResponseWriter, r *http.Request) {
+ xappName := mux.Vars(r)["name"]
+ if xappName == "" || r.Body == nil {
+ respondWithJSON(w, http.StatusBadRequest, nil)
+ return
+ }
+ defer r.Body.Close()
+
+ body, err := ioutil.ReadAll(r.Body)
+ if err != nil {
+ Logger.Error("ioutil.ReadAll failed: %v", err)
+ respondWithJSON(w, http.StatusInternalServerError, nil)
+ return
+ }
+
+ if err := PublishConfigChange(xappName, string(body)); err != nil {
+ respondWithJSON(w, http.StatusInternalServerError, nil)
+ return
+ }
+
+ respondWithJSON(w, http.StatusOK, nil)
+}
+