mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-08 03:00:26 +08:00
实现路径规则各项数据修改
This commit is contained in:
@@ -118,6 +118,7 @@ func (this *HTTPLocationDAO) ComposeLocationConfig(locationId int64) (*servercon
|
|||||||
config.Name = location.Name
|
config.Name = location.Name
|
||||||
config.Pattern = location.Pattern
|
config.Pattern = location.Pattern
|
||||||
config.URLPrefix = location.UrlPrefix
|
config.URLPrefix = location.UrlPrefix
|
||||||
|
config.IsBreak = location.IsBreak == 1
|
||||||
|
|
||||||
// web
|
// web
|
||||||
if location.WebId > 0 {
|
if location.WebId > 0 {
|
||||||
|
|||||||
@@ -99,6 +99,14 @@ func (this *HTTPLocationService) FindAndInitHTTPLocationReverseProxyConfig(ctx c
|
|||||||
IsOn: false,
|
IsOn: false,
|
||||||
ReverseProxyId: reverseProxyId,
|
ReverseProxyId: reverseProxyId,
|
||||||
}
|
}
|
||||||
|
reverseProxyJSON, err := json.Marshal(reverseProxyRef)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = models.SharedHTTPLocationDAO.UpdateLocationReverseProxy(req.LocationId, reverseProxyJSON)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reverseProxyConfig, err := models.SharedReverseProxyDAO.ComposeReverseProxyConfig(reverseProxyRef.ReverseProxyId)
|
reverseProxyConfig, err := models.SharedReverseProxyDAO.ComposeReverseProxyConfig(reverseProxyRef.ReverseProxyId)
|
||||||
@@ -139,6 +147,10 @@ func (this *HTTPLocationService) FindAndInitHTTPLocationWebConfig(ctx context.Co
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
err = models.SharedHTTPLocationDAO.UpdateLocationWeb(req.LocationId, webId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config, err := models.SharedHTTPWebDAO.ComposeWebConfig(webId)
|
config, err := models.SharedHTTPWebDAO.ComposeWebConfig(webId)
|
||||||
@@ -153,3 +165,18 @@ func (this *HTTPLocationService) FindAndInitHTTPLocationWebConfig(ctx context.Co
|
|||||||
WebJSON: configJSON,
|
WebJSON: configJSON,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改反向代理设置
|
||||||
|
func (this *HTTPLocationService) UpdateHTTPLocationReverseProxy(ctx context.Context, req *pb.UpdateHTTPLocationReverseProxyRequest) (*pb.RPCUpdateSuccess, error) {
|
||||||
|
// 校验请求
|
||||||
|
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = models.SharedHTTPLocationDAO.UpdateLocationReverseProxy(req.LocationId, req.ReverseProxyJSON)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rpcutils.RPCUpdateSuccess()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user