2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 00:39:32 +08:00

feat: OpenResty支持返回具体错误

This commit is contained in:
耗子
2024-06-25 03:35:35 +08:00
parent 63838bffa1
commit b4e5498b48
6 changed files with 48 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
package plugins
import (
"fmt"
"regexp"
"time"
@@ -61,7 +62,8 @@ func (r *OpenRestyController) SaveConfig(ctx http.Context) http.Response {
}
if err := systemctl.Reload("openresty"); err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "重载服务失败")
_, err = shell.Execf("openresty -t")
return controllers.Error(ctx, http.StatusInternalServerError, fmt.Sprintf("重载服务失败: %v", err))
}
return controllers.Success(ctx, nil)

View File

@@ -88,8 +88,9 @@ func (r *PhpMyAdminController) SetPort(ctx http.Context) http.Response {
}
}
if err := systemctl.Reload("openresty"); err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "重载OpenResty失败")
if err = systemctl.Reload("openresty"); err != nil {
_, err = shell.Execf("openresty -t")
return controllers.Error(ctx, http.StatusInternalServerError, fmt.Sprintf("重载OpenResty失败: %v", err))
}
return controllers.Success(ctx, nil)