Chore: merge branch 'with-tun' into plus-pro
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user