From 1db4904362cfd40dfb489542c3e42c069f72765d Mon Sep 17 00:00:00 2001 From: luruichao <110596971+chaoranz758@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:41:50 +0800 Subject: [PATCH] feat: support user-defined render.json (#91) --- pkg/server/hz.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/server/hz.go b/pkg/server/hz.go index 39a6ea95..e0d1fbd2 100644 --- a/pkg/server/hz.go +++ b/pkg/server/hz.go @@ -49,10 +49,20 @@ func convertHzArgument(sa *config.ServerArgument, hzArgument *hzConfig.Argument) gitPath = path.Join(tpl.HertzDir, consts.Server, gitPath) hzArgument.CustomizeLayout = path.Join(gitPath, consts.LayoutFile) hzArgument.CustomizePackage = path.Join(gitPath, consts.PackageLayoutFile) + layoutDataPath := path.Join(gitPath, "render.json") + isExist, _ := utils.PathExist(layoutDataPath) + if isExist { + hzArgument.CustomizeLayoutData = layoutDataPath + } } else { if len(sa.Template) != 0 { hzArgument.CustomizeLayout = path.Join(sa.Template, consts.LayoutFile) hzArgument.CustomizePackage = path.Join(sa.Template, consts.PackageLayoutFile) + layoutDataPath := path.Join(sa.Template, "render.json") + isExist, _ := utils.PathExist(layoutDataPath) + if isExist { + hzArgument.CustomizeLayoutData = layoutDataPath + } } else { hzArgument.CustomizeLayout = path.Join(tpl.HertzDir, consts.Server, consts.Standard, consts.LayoutFile) hzArgument.CustomizePackage = path.Join(tpl.HertzDir, consts.Server, consts.Standard, consts.PackageLayoutFile)