mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-09 12:00:25 +08:00
当服务配置变化时创建单个服务通知任务
This commit is contained in:
@@ -1924,3 +1924,29 @@ func (this *ServerService) FindServerUserPlan(ctx context.Context, req *pb.FindS
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ComposeServerConfig 获取服务配置
|
||||
func (this *ServerService) ComposeServerConfig(ctx context.Context, req *pb.ComposeServerConfigRequest) (*pb.ComposeServerConfigResponse, error) {
|
||||
_, err := this.ValidateNode(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
serverConfig, err := models.SharedServerDAO.ComposeServerConfigWithServerId(tx, req.ServerId, true)
|
||||
if err != nil {
|
||||
if err == models.ErrNotFound {
|
||||
return &pb.ComposeServerConfigResponse{ServerConfigJSON: nil}, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if serverConfig == nil {
|
||||
return &pb.ComposeServerConfigResponse{ServerConfigJSON: nil}, nil
|
||||
}
|
||||
|
||||
configJSON, err := json.Marshal(serverConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.ComposeServerConfigResponse{ServerConfigJSON: configJSON}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user