Chore: code style

This commit is contained in:
yaling888
2022-06-06 02:37:10 +08:00
parent bf9eb000d2
commit 763929997b
11 changed files with 44 additions and 307 deletions

View File

@ -169,13 +169,13 @@ func updateConfigs(w http.ResponseWriter, r *http.Request) {
var err error
if req.Payload != "" {
log.Warnln("[REST-API] update config by payload")
cfg, err = executor.ParseWithBytes([]byte(req.Payload))
if err != nil {
render.Status(r, http.StatusBadRequest)
render.JSON(w, r, newError(err.Error()))
return
}
log.Warnln("[REST-API] update config by payload")
} else {
if req.Path == "" {
req.Path = constant.Path.Config()
@ -186,13 +186,13 @@ func updateConfigs(w http.ResponseWriter, r *http.Request) {
return
}
log.Warnln("[REST-API] reload config from path: %s", req.Path)
cfg, err = executor.ParseWithPath(req.Path)
if err != nil {
render.Status(r, http.StatusBadRequest)
render.JSON(w, r, newError(err.Error()))
return
}
log.Warnln("[REST-API] reload config from path: %s", req.Path)
}
executor.ApplyConfig(cfg, force)