|
|
@ -12,7 +12,7 @@ import ( |
|
|
|
// @Description 获取 OpenResty 配置信息
|
|
|
|
// @Description 获取 OpenResty 配置信息
|
|
|
|
// @Success 200 {object} response.FileInfo
|
|
|
|
// @Success 200 {object} response.FileInfo
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Router /openResty [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 { |
|
|
@ -29,7 +29,7 @@ func (b *BaseApi) GetNginx(c *gin.Context) { |
|
|
|
// @Param request body request.NginxScopeReq true "request"
|
|
|
|
// @Param request body request.NginxScopeReq true "request"
|
|
|
|
// @Success 200 {array} response.NginxParam
|
|
|
|
// @Success 200 {array} response.NginxParam
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Router /openResty/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 := helper.CheckBindAndValidate(&req, c); err != nil { |
|
|
|
if err := helper.CheckBindAndValidate(&req, c); err != nil { |
|
|
@ -51,7 +51,7 @@ func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) { |
|
|
|
// @Param request body request.NginxConfigUpdate true "request"
|
|
|
|
// @Param request body request.NginxConfigUpdate true "request"
|
|
|
|
// @Success 200
|
|
|
|
// @Success 200
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Router /openResty/update [post]
|
|
|
|
// @Router /openresty/update [post]
|
|
|
|
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteId","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"更新 nginx 配置 [domain]","formatEN":"Update nginx conf [domain]"}
|
|
|
|
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteId","isList":false,"db":"websites","output_column":"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 |
|
|
@ -70,7 +70,7 @@ func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) { |
|
|
|
// @Description 获取 OpenResty 状态信息
|
|
|
|
// @Description 获取 OpenResty 状态信息
|
|
|
|
// @Success 200 {object} response.NginxStatus
|
|
|
|
// @Success 200 {object} response.NginxStatus
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Router /openResty/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 { |
|
|
@ -87,7 +87,7 @@ func (b *BaseApi) GetNginxStatus(c *gin.Context) { |
|
|
|
// @Param request body request.NginxConfigFileUpdate true "request"
|
|
|
|
// @Param request body request.NginxConfigFileUpdate true "request"
|
|
|
|
// @Success 200
|
|
|
|
// @Success 200
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Router /openResty/file [post]
|
|
|
|
// @Router /openresty/file [post]
|
|
|
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 nginx 配置","formatEN":"Update nginx conf"}
|
|
|
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"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 |
|
|
@ -107,7 +107,7 @@ func (b *BaseApi) UpdateNginxFile(c *gin.Context) { |
|
|
|
// @Description 清理 OpenResty 代理缓存
|
|
|
|
// @Description 清理 OpenResty 代理缓存
|
|
|
|
// @Success 200
|
|
|
|
// @Success 200
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Security ApiKeyAuth
|
|
|
|
// @Router /openResty/clear [post]
|
|
|
|
// @Router /openresty/clear [post]
|
|
|
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清理 Openresty 代理缓存","formatEN":"Clear nginx proxy cache"}
|
|
|
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清理 Openresty 代理缓存","formatEN":"Clear nginx proxy cache"}
|
|
|
|
func (b *BaseApi) ClearNginxProxyCache(c *gin.Context) { |
|
|
|
func (b *BaseApi) ClearNginxProxyCache(c *gin.Context) { |
|
|
|
if err := nginxService.ClearProxyCache(); err != nil { |
|
|
|
if err := nginxService.ClearProxyCache(); err != nil { |
|
|
|