mirror of https://github.com/1Panel-dev/1Panel
feat: 修改 OpenResty 的key 为 openresty
parent
1fa970fbc1
commit
6639192c9a
|
@ -7,12 +7,12 @@ import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Tags Nginx
|
// @Tags OpenResty
|
||||||
// @Summary Load nginx conf
|
// @Summary Load OpenResty conf
|
||||||
// @Description 获取 nginx 配置信息
|
// @Description 获取 OpenResty 配置信息
|
||||||
// @Success 200 {object} response.FileInfo
|
// @Success 200 {object} response.FileInfo
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /nginx [get]
|
// @Router /openResty [get]
|
||||||
func (b *BaseApi) GetNginx(c *gin.Context) {
|
func (b *BaseApi) GetNginx(c *gin.Context) {
|
||||||
fileInfo, err := nginxService.GetNginxConfig()
|
fileInfo, err := nginxService.GetNginxConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -22,14 +22,14 @@ func (b *BaseApi) GetNginx(c *gin.Context) {
|
||||||
helper.SuccessWithData(c, fileInfo)
|
helper.SuccessWithData(c, fileInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Nginx
|
// @Tags OpenResty
|
||||||
// @Summary Load partial nginx conf
|
// @Summary Load partial OpenResty conf
|
||||||
// @Description 获取部分 nginx 配置信息
|
// @Description 获取部分 OpenResty 配置信息
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body request.NginxScopeReq true "request"
|
// @Param request body request.NginxScopeReq true "request"
|
||||||
// @Success 200 {anrry} response.NginxParam
|
// @Success 200 {anrry} response.NginxParam
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /nginx/scope [post]
|
// @Router /openResty/scope [post]
|
||||||
func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
|
func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
|
||||||
var req request.NginxScopeReq
|
var req request.NginxScopeReq
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
@ -45,14 +45,14 @@ func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
|
||||||
helper.SuccessWithData(c, params)
|
helper.SuccessWithData(c, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Nginx
|
// @Tags OpenResty
|
||||||
// @Summary Update nginx conf
|
// @Summary Update OpenResty conf
|
||||||
// @Description 更新 nginx 配置信息
|
// @Description 更新 OpenResty 配置信息
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body request.NginxConfigUpdate true "request"
|
// @Param request body request.NginxConfigUpdate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /nginx/update [post]
|
// @Router /openResty/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"websiteId","isList":false,"db":"websites","output_colume":"primary_domain","output_value":"domain"}],"formatZH":"更新 nginx 配置 [domain]","formatEN":"Update nginx conf [domain]"}
|
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"websiteId","isList":false,"db":"websites","output_colume":"primary_domain","output_value":"domain"}],"formatZH":"更新 nginx 配置 [domain]","formatEN":"Update nginx conf [domain]"}
|
||||||
func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
|
func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
|
||||||
var req request.NginxConfigUpdate
|
var req request.NginxConfigUpdate
|
||||||
|
@ -67,12 +67,12 @@ func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
|
||||||
helper.SuccessWithData(c, nil)
|
helper.SuccessWithData(c, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Nginx
|
// @Tags OpenResty
|
||||||
// @Summary Load nginx status info
|
// @Summary Load OpenResty status info
|
||||||
// @Description 获取 nginx 状态信息
|
// @Description 获取 OpenResty 状态信息
|
||||||
// @Success 200 {object} response.NginxStatus
|
// @Success 200 {object} response.NginxStatus
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /nginx/status [get]
|
// @Router /openResty/status [get]
|
||||||
func (b *BaseApi) GetNginxStatus(c *gin.Context) {
|
func (b *BaseApi) GetNginxStatus(c *gin.Context) {
|
||||||
res, err := nginxService.GetStatus()
|
res, err := nginxService.GetStatus()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -82,14 +82,14 @@ func (b *BaseApi) GetNginxStatus(c *gin.Context) {
|
||||||
helper.SuccessWithData(c, res)
|
helper.SuccessWithData(c, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Nginx
|
// @Tags OpenResty
|
||||||
// @Summary Update nginx conf by upload file
|
// @Summary Update OpenResty conf by upload file
|
||||||
// @Description 上传更新 nginx 配置文件
|
// @Description 上传更新 OpenResty 配置文件
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body request.NginxConfigFileUpdate true "request"
|
// @Param request body request.NginxConfigFileUpdate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /nginx/file [post]
|
// @Router /openResty/file [post]
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新 nginx 配置","formatEN":"Update nginx conf"}
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新 nginx 配置","formatEN":"Update nginx conf"}
|
||||||
func (b *BaseApi) UpdateNginxFile(c *gin.Context) {
|
func (b *BaseApi) UpdateNginxFile(c *gin.Context) {
|
||||||
var req request.NginxConfigFileUpdate
|
var req request.NginxConfigFileUpdate
|
||||||
|
|
|
@ -324,7 +324,7 @@ func (a AppInstallService) DeleteCheck(installId uint) ([]dto.AppResource, error
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if app.Key == constant.AppNginx {
|
if app.Key == constant.AppOpenresty {
|
||||||
websites, _ := websiteRepo.GetBy()
|
websites, _ := websiteRepo.GetBy()
|
||||||
for _, website := range websites {
|
for _, website := range websites {
|
||||||
res = append(res, dto.AppResource{
|
res = append(res, dto.AppResource{
|
||||||
|
@ -369,7 +369,7 @@ func (a AppInstallService) GetDefaultConfigByKey(key string) (string, error) {
|
||||||
if key == constant.AppRedis {
|
if key == constant.AppRedis {
|
||||||
filePath = path.Join(filePath, "redis.conf")
|
filePath = path.Join(filePath, "redis.conf")
|
||||||
}
|
}
|
||||||
if key == constant.AppNginx {
|
if key == constant.AppOpenresty {
|
||||||
filePath = path.Join(filePath, "nginx.conf")
|
filePath = path.Join(filePath, "nginx.conf")
|
||||||
}
|
}
|
||||||
contentByte, err := os.ReadFile(filePath)
|
contentByte, err := os.ReadFile(filePath)
|
||||||
|
|
|
@ -19,11 +19,11 @@ type NginxService struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n NginxService) GetNginxConfig() (response.FileInfo, error) {
|
func (n NginxService) GetNginxConfig() (response.FileInfo, error) {
|
||||||
nginxInstall, err := getAppInstallByKey(constant.AppNginx)
|
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response.FileInfo{}, err
|
return response.FileInfo{}, err
|
||||||
}
|
}
|
||||||
configPath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "conf", "nginx.conf")
|
configPath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "conf", "nginx.conf")
|
||||||
info, err := files.NewFileInfo(files.FileOption{
|
info, err := files.NewFileInfo(files.FileOption{
|
||||||
Path: configPath,
|
Path: configPath,
|
||||||
Expand: true,
|
Expand: true,
|
||||||
|
@ -95,7 +95,7 @@ func (n NginxService) UpdateConfigFile(req request.NginxConfigFileUpdate) error
|
||||||
if err := fileOp.WriteFile(req.FilePath, strings.NewReader(req.Content), 0644); err != nil {
|
if err := fileOp.WriteFile(req.FilePath, strings.NewReader(req.Content), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
nginxInstall, err := getAppInstallByKey(constant.AppNginx)
|
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ import (
|
||||||
|
|
||||||
func getNginxFull(website *model.Website) (dto.NginxFull, error) {
|
func getNginxFull(website *model.Website) (dto.NginxFull, error) {
|
||||||
var nginxFull dto.NginxFull
|
var nginxFull dto.NginxFull
|
||||||
nginxInstall, err := getAppInstallByKey("nginx")
|
nginxInstall, err := getAppInstallByKey("openresty")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nginxFull, err
|
return nginxFull, err
|
||||||
}
|
}
|
||||||
nginxFull.Install = nginxInstall
|
nginxFull.Install = nginxInstall
|
||||||
nginxFull.Dir = path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name)
|
nginxFull.Dir = path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name)
|
||||||
nginxFull.ConfigDir = path.Join(nginxFull.Dir, "conf")
|
nginxFull.ConfigDir = path.Join(nginxFull.Dir, "conf")
|
||||||
nginxFull.ConfigFile = "nginx.conf"
|
nginxFull.ConfigFile = "nginx.conf"
|
||||||
nginxFull.SiteDir = path.Join(nginxFull.Dir, "www")
|
nginxFull.SiteDir = path.Join(nginxFull.Dir, "www")
|
||||||
|
@ -47,7 +47,7 @@ func getNginxFull(website *model.Website) (dto.NginxFull, error) {
|
||||||
nginxFull.Website = *website
|
nginxFull.Website = *website
|
||||||
var siteNginxConfig dto.NginxConfig
|
var siteNginxConfig dto.NginxConfig
|
||||||
nginxFileName := website.Alias + ".conf"
|
nginxFileName := website.Alias + ".conf"
|
||||||
siteConfigPath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "conf", "conf.d", nginxFileName)
|
siteConfigPath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "conf", "conf.d", nginxFileName)
|
||||||
siteNginxConfig.FilePath = siteConfigPath
|
siteNginxConfig.FilePath = siteConfigPath
|
||||||
siteNginxContent, err := os.ReadFile(siteConfigPath)
|
siteNginxContent, err := os.ReadFile(siteConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -293,11 +293,11 @@ func (w WebsiteService) GetWebsite(id uint) (response.WebsiteDTO, error) {
|
||||||
}
|
}
|
||||||
res.Website = website
|
res.Website = website
|
||||||
|
|
||||||
nginxInstall, err := getAppInstallByKey(constant.AppNginx)
|
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
sitePath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "www", "sites", website.Alias)
|
sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias)
|
||||||
res.ErrorLogPath = path.Join(sitePath, "log", "error.log")
|
res.ErrorLogPath = path.Join(sitePath, "log", "error.log")
|
||||||
res.AccessLogPath = path.Join(sitePath, "log", "access.log")
|
res.AccessLogPath = path.Join(sitePath, "log", "access.log")
|
||||||
res.SitePath = sitePath
|
res.SitePath = sitePath
|
||||||
|
@ -468,7 +468,7 @@ func (w WebsiteService) GetWebsiteNginxConfig(websiteId uint) (response.FileInfo
|
||||||
return response.FileInfo{}, err
|
return response.FileInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
|
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppOpenresty))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response.FileInfo{}, err
|
return response.FileInfo{}, err
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ func (w WebsiteService) GetWebsiteNginxConfig(websiteId uint) (response.FileInfo
|
||||||
return response.FileInfo{}, err
|
return response.FileInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
configPath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "conf", "conf.d", website.Alias+".conf")
|
configPath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "conf", "conf.d", website.Alias+".conf")
|
||||||
|
|
||||||
info, err := files.NewFileInfo(files.FileOption{
|
info, err := files.NewFileInfo(files.FileOption{
|
||||||
Path: configPath,
|
Path: configPath,
|
||||||
|
@ -619,7 +619,7 @@ func (w WebsiteService) PreInstallCheck(req request.WebsiteInstallCheckReq) ([]r
|
||||||
showErr = false
|
showErr = false
|
||||||
)
|
)
|
||||||
|
|
||||||
app, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
|
app, err := appRepo.GetFirst(appRepo.WithKey(constant.AppOpenresty))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,11 +92,11 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
case constant.Http:
|
case constant.Http:
|
||||||
appInstall, err := getAppInstallByKey(constant.AppNginx)
|
appInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return request.WebsiteSSLCreate{}, err
|
return request.WebsiteSSLCreate{}, err
|
||||||
}
|
}
|
||||||
if err := client.UseHTTP(path.Join(constant.AppInstallDir, constant.AppNginx, appInstall.Name, "root")); err != nil {
|
if err := client.UseHTTP(path.Join(constant.AppInstallDir, constant.AppOpenresty, appInstall.Name, "root")); err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,11 +160,11 @@ func (w WebsiteSSLService) Renew(sslId uint) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case constant.Http:
|
case constant.Http:
|
||||||
appInstall, err := getAppInstallByKey(constant.AppNginx)
|
appInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := client.UseHTTP(path.Join(constant.AppInstallDir, constant.AppNginx, appInstall.Name, "root")); err != nil {
|
if err := client.UseHTTP(path.Join(constant.AppInstallDir, constant.AppOpenresty, appInstall.Name, "root")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ func (w WebsiteSSLService) Renew(sslId uint) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(websites) > 0 {
|
if len(websites) > 0 {
|
||||||
nginxInstall, err := getAppInstallByKey(constant.AppNginx)
|
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,12 @@ func getDomain(domainStr string, websiteID uint) (model.WebsiteDomain, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createStaticHtml(website *model.Website) error {
|
func createStaticHtml(website *model.Website) error {
|
||||||
nginxInstall, err := getAppInstallByKey(constant.AppNginx)
|
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
indexFolder := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "www", "sites", website.Alias, "index")
|
indexFolder := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias, "index")
|
||||||
indexPath := path.Join(indexFolder, "index.html")
|
indexPath := path.Join(indexFolder, "index.html")
|
||||||
indexContent := string(nginx_conf.Index)
|
indexContent := string(nginx_conf.Index)
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
|
@ -77,7 +77,7 @@ func createStaticHtml(website *model.Website) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createWebsiteFolder(nginxInstall model.AppInstall, website *model.Website) error {
|
func createWebsiteFolder(nginxInstall model.AppInstall, website *model.Website) error {
|
||||||
nginxFolder := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name)
|
nginxFolder := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name)
|
||||||
siteFolder := path.Join(nginxFolder, "www", "sites", website.Alias)
|
siteFolder := path.Join(nginxFolder, "www", "sites", website.Alias)
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
if !fileOp.Stat(siteFolder) {
|
if !fileOp.Stat(siteFolder) {
|
||||||
|
@ -109,7 +109,7 @@ func createWebsiteFolder(nginxInstall model.AppInstall, website *model.Website)
|
||||||
}
|
}
|
||||||
|
|
||||||
func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, appInstall *model.AppInstall) error {
|
func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, appInstall *model.AppInstall) error {
|
||||||
nginxInstall, err := getAppInstallByKey(constant.AppNginx)
|
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, a
|
||||||
}
|
}
|
||||||
|
|
||||||
nginxFileName := website.Alias + ".conf"
|
nginxFileName := website.Alias + ".conf"
|
||||||
configPath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "conf", "conf.d", nginxFileName)
|
configPath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "conf", "conf.d", nginxFileName)
|
||||||
nginxContent := string(nginx_conf.WebsiteDefault)
|
nginxContent := string(nginx_conf.WebsiteDefault)
|
||||||
config := parser.NewStringParser(nginxContent).Parse()
|
config := parser.NewStringParser(nginxContent).Parse()
|
||||||
servers := config.FindServers()
|
servers := config.FindServers()
|
||||||
|
@ -169,7 +169,7 @@ func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, a
|
||||||
}
|
}
|
||||||
|
|
||||||
func delNginxConfig(website model.Website, force bool) error {
|
func delNginxConfig(website model.Website, force bool) error {
|
||||||
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
|
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppOpenresty))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ func delNginxConfig(website model.Website, force bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
nginxFileName := website.Alias + ".conf"
|
nginxFileName := website.Alias + ".conf"
|
||||||
configPath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "conf", "conf.d", nginxFileName)
|
configPath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "conf", "conf.d", nginxFileName)
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
|
|
||||||
if !fileOp.Stat(configPath) {
|
if !fileOp.Stat(configPath) {
|
||||||
|
@ -191,7 +191,7 @@ func delNginxConfig(website model.Website, force bool) error {
|
||||||
if err := fileOp.DeleteFile(configPath); err != nil {
|
if err := fileOp.DeleteFile(configPath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
sitePath := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "www", "sites", website.PrimaryDomain)
|
sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.PrimaryDomain)
|
||||||
if fileOp.Stat(sitePath) {
|
if fileOp.Stat(sitePath) {
|
||||||
_ = fileOp.DeleteDir(sitePath)
|
_ = fileOp.DeleteDir(sitePath)
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ func deleteListenAndServerName(website model.Website, ports []int, domains []str
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPemFile(website model.Website, websiteSSL model.WebsiteSSL) error {
|
func createPemFile(website model.Website, websiteSSL model.WebsiteSSL) error {
|
||||||
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppNginx))
|
nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppOpenresty))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ func createPemFile(website model.Website, websiteSSL model.WebsiteSSL) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
configDir := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name, "www", "sites", website.Alias, "ssl")
|
configDir := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias, "ssl")
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
|
|
||||||
if !fileOp.Stat(configDir) {
|
if !fileOp.Stat(configDir) {
|
||||||
|
@ -417,7 +417,7 @@ func handleWebsiteBackup(backupType, baseDir, backupDir, domain, backupName stri
|
||||||
}
|
}
|
||||||
global.LOG.Info("put website into tmp dir successful")
|
global.LOG.Info("put website into tmp dir successful")
|
||||||
|
|
||||||
nginxInfo, err := appInstallRepo.LoadBaseInfo(constant.AppNginx, "")
|
nginxInfo, err := appInstallRepo.LoadBaseInfo(constant.AppOpenresty, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ func handleWebsiteBackup(backupType, baseDir, backupDir, domain, backupName stri
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleWebsiteRecover(website *model.Website, fileDir string) error {
|
func handleWebsiteRecover(website *model.Website, fileDir string) error {
|
||||||
nginxInfo, err := appInstallRepo.LoadBaseInfo(constant.AppNginx, "")
|
nginxInfo, err := appInstallRepo.LoadBaseInfo(constant.AppOpenresty, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ func saveWebsiteJson(website *model.Website, tmpDir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteWebsiteFolder(nginxInstall model.AppInstall, website *model.Website) error {
|
func deleteWebsiteFolder(nginxInstall model.AppInstall, website *model.Website) error {
|
||||||
nginxFolder := path.Join(constant.AppInstallDir, constant.AppNginx, nginxInstall.Name)
|
nginxFolder := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name)
|
||||||
siteFolder := path.Join(nginxFolder, "www", "sites", website.Alias)
|
siteFolder := path.Join(nginxFolder, "www", "sites", website.Alias)
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
if fileOp.Stat(siteFolder) {
|
if fileOp.Stat(siteFolder) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ const (
|
||||||
AppNormal = "Normal"
|
AppNormal = "Normal"
|
||||||
AppTakeDown = "TakeDown"
|
AppTakeDown = "TakeDown"
|
||||||
|
|
||||||
AppNginx = "nginx"
|
AppOpenresty = "openresty"
|
||||||
AppMysql = "mysql"
|
AppMysql = "mysql"
|
||||||
AppRedis = "redis"
|
AppRedis = "redis"
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ type NginxRouter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *NginxRouter) InitNginxRouter(Router *gin.RouterGroup) {
|
func (a *NginxRouter) InitNginxRouter(Router *gin.RouterGroup) {
|
||||||
groupRouter := Router.Group("nginx")
|
groupRouter := Router.Group("openresty")
|
||||||
groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth())
|
groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth())
|
||||||
|
|
||||||
baseApi := v1.ApiGroupApp.BaseApi
|
baseApi := v1.ApiGroupApp.BaseApi
|
||||||
|
|
|
@ -3,21 +3,21 @@ import { File } from '../interface/file';
|
||||||
import { Nginx } from '../interface/nginx';
|
import { Nginx } from '../interface/nginx';
|
||||||
|
|
||||||
export const GetNginx = () => {
|
export const GetNginx = () => {
|
||||||
return http.get<File.File>(`/nginx`);
|
return http.get<File.File>(`/openresty`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GetNginxConfigByScope = (req: Nginx.NginxScopeReq) => {
|
export const GetNginxConfigByScope = (req: Nginx.NginxScopeReq) => {
|
||||||
return http.post<Nginx.NginxParam[]>(`/nginx/scope`, req);
|
return http.post<Nginx.NginxParam[]>(`/openresty/scope`, req);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UpdateNginxConfigByScope = (req: Nginx.NginxConfigReq) => {
|
export const UpdateNginxConfigByScope = (req: Nginx.NginxConfigReq) => {
|
||||||
return http.post<any>(`/nginx/update`, req);
|
return http.post<any>(`/openresty/update`, req);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GetNginxStatus = () => {
|
export const GetNginxStatus = () => {
|
||||||
return http.get<Nginx.NginxStatus>(`/nginx/status`);
|
return http.get<Nginx.NginxStatus>(`/openresty/status`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UpdateNginxConfigFile = (req: Nginx.NginxFileUpdate) => {
|
export const UpdateNginxConfigFile = (req: Nginx.NginxFileUpdate) => {
|
||||||
return http.post<any>(`/nginx/file`, req);
|
return http.post<any>(`/openresty/file`, req);
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,7 @@ import { MsgSuccess } from '@/utils/message';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
appKey: {
|
appKey: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'nginx',
|
default: 'openresty',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
v-for="(button, key) in buttons"
|
v-for="(button, key) in buttons"
|
||||||
:key="key"
|
:key="key"
|
||||||
:type="!button.disabled ? 'primary' : 'info'"
|
:type="button.disabled && button.disabled(installed) ? 'info' : 'primary'"
|
||||||
plain
|
plain
|
||||||
round
|
round
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -316,6 +316,9 @@ const buttons = [
|
||||||
click: (row: any) => {
|
click: (row: any) => {
|
||||||
openOperate(row, 'down');
|
openOperate(row, 'down');
|
||||||
},
|
},
|
||||||
|
disabled: (row: any) => {
|
||||||
|
return row.status !== 'Running';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: i18n.global.t('app.delete'),
|
label: i18n.global.t('app.delete'),
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<LayoutContent :title="$t('website.website')" v-loading="loading">
|
<LayoutContent :title="$t('website.website')" v-loading="loading">
|
||||||
<template #app>
|
<template #app>
|
||||||
<AppStatus
|
<AppStatus
|
||||||
:app-key="'nginx'"
|
:app-key="'openresty'"
|
||||||
@setting="setting"
|
@setting="setting"
|
||||||
v-model:loading="loading"
|
v-model:loading="loading"
|
||||||
@is-exist="checkExist"
|
@is-exist="checkExist"
|
||||||
|
|
Loading…
Reference in New Issue