Skip to content

Commit

Permalink
feat: support user-defined render.json (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoranz758 authored Oct 18, 2023
1 parent 2e62e52 commit 1db4904
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/server/hz.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1db4904

Please sign in to comment.