mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 11:27:17 +08:00
refactor: 重命名openresty为nginx
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
_ "github.com/TheTNB/panel/internal/apps/frp"
|
||||
_ "github.com/TheTNB/panel/internal/apps/gitea"
|
||||
_ "github.com/TheTNB/panel/internal/apps/mysql"
|
||||
_ "github.com/TheTNB/panel/internal/apps/openresty"
|
||||
_ "github.com/TheTNB/panel/internal/apps/nginx"
|
||||
_ "github.com/TheTNB/panel/internal/apps/php"
|
||||
_ "github.com/TheTNB/panel/internal/apps/phpmyadmin"
|
||||
_ "github.com/TheTNB/panel/internal/apps/podman"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openresty
|
||||
package nginx
|
||||
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
apploader.Register(&types.App{
|
||||
Slug: "openresty",
|
||||
Slug: "nginx",
|
||||
Route: func(r chi.Router) {
|
||||
service := NewService()
|
||||
r.Get("/load", service.Load)
|
||||
@@ -1,4 +1,4 @@
|
||||
package openresty
|
||||
package nginx
|
||||
|
||||
type UpdateConfig struct {
|
||||
Config string `form:"config" json:"config"`
|
||||
@@ -1,4 +1,4 @@
|
||||
package openresty
|
||||
package nginx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -27,7 +27,7 @@ func NewService() *Service {
|
||||
}
|
||||
|
||||
func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
config, err := io.Read(fmt.Sprintf("%s/server/openresty/conf/nginx.conf", app.Root))
|
||||
config, err := io.Read(fmt.Sprintf("%s/server/nginx/conf/nginx.conf", app.Root))
|
||||
if err != nil {
|
||||
service.Error(w, http.StatusInternalServerError, "获取配置失败")
|
||||
return
|
||||
@@ -43,13 +43,13 @@ func (s *Service) SaveConfig(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err = io.Write(fmt.Sprintf("%s/server/openresty/conf/nginx.conf", app.Root), req.Config, 0644); err != nil {
|
||||
if err = io.Write(fmt.Sprintf("%s/server/nginx/conf/nginx.conf", app.Root), req.Config, 0644); err != nil {
|
||||
service.Error(w, http.StatusInternalServerError, "保存配置失败")
|
||||
return
|
||||
}
|
||||
|
||||
if err = systemctl.Reload("openresty"); err != nil {
|
||||
_, err = shell.Execf("openresty -t")
|
||||
if err = systemctl.Reload("nginx"); err != nil {
|
||||
_, err = shell.Execf("nginx -t")
|
||||
service.Error(w, http.StatusInternalServerError, "重载服务失败:%v", err)
|
||||
return
|
||||
}
|
||||
@@ -86,8 +86,8 @@ func (s *Service) UpdatePort(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err = systemctl.Reload("openresty"); err != nil {
|
||||
_, err = shell.Execf("openresty -t")
|
||||
if err = systemctl.Reload("nginx"); err != nil {
|
||||
_, err = shell.Execf("nginx -t")
|
||||
service.Error(w, http.StatusInternalServerError, "重载OpenResty失败:%v", err)
|
||||
return
|
||||
}
|
||||
@@ -117,8 +117,8 @@ func (s *Service) UpdateConfig(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err = systemctl.Reload("openresty"); err != nil {
|
||||
_, err = shell.Execf("openresty -t")
|
||||
if err = systemctl.Reload("nginx"); err != nil {
|
||||
_, err = shell.Execf("nginx -t")
|
||||
service.Error(w, http.StatusInternalServerError, "重载OpenResty失败:%v", err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user