diff --git a/tpl/hertz/server/standard/layout.yaml b/tpl/hertz/server/standard/layout.yaml index 0ed37af0..3e4978e8 100644 --- a/tpl/hertz/server/standard/layout.yaml +++ b/tpl/hertz/server/standard/layout.yaml @@ -70,7 +70,7 @@ layouts: if conf.GetConf().Hertz.EnablePprof { pprof.Register(h) } - + // gzip if conf.GetConf().Hertz.EnableGzip { h.Use(gzip.Gzip(gzip.DefaultCompression)) @@ -90,8 +90,8 @@ layouts: - path: go.mod delims: - - '{{' - - '}}' + - "{{" + - "}}" body: |- module {{.GoModule}} {{- if .UseApacheThrift}} @@ -161,15 +161,16 @@ layouts: } type Hertz struct { - Address string `yaml:"address"` - EnablePprof bool `yaml:"enable_pprof"` - EnableGzip bool `yaml:"enable_gzip"` + Service string `yaml:"service"` + Address string `yaml:"address"` + EnablePprof bool `yaml:"enable_pprof"` + EnableGzip bool `yaml:"enable_gzip"` EnableAccessLog bool `yaml:"enable_access_log"` - LogLevel string `yaml:"log_level"` - LogFileName string `yaml:"log_file_name"` - LogMaxSize int `yaml:"log_max_size"` - LogMaxBackups int `yaml:"log_max_backups"` - LogMaxAge int `yaml:"log_max_age"` + LogLevel string `yaml:"log_level"` + LogFileName string `yaml:"log_file_name"` + LogMaxSize int `yaml:"log_max_size"` + LogMaxBackups int `yaml:"log_max_backups"` + LogMaxAge int `yaml:"log_max_age"` } // GetConf gets configuration instance @@ -232,13 +233,13 @@ layouts: } } - - path: conf/dev/conf.yaml delims: - "" - "" body: |- hertz: + service: "{{.ServiceName}}" address: ":8080" enable_pprof: true enable_gzip: true @@ -264,6 +265,7 @@ layouts: - "" body: |- hertz: + service: "{{.ServiceName}}" address: ":8080" enable_pprof: false enable_gzip: true @@ -289,6 +291,7 @@ layouts: - "" body: |- hertz: + service: "{{.ServiceName}}" address: ":8080" enable_pprof: true enable_gzip: true @@ -308,7 +311,6 @@ layouts: password: "" db: 0 - - path: biz/dal/init.go delims: - "" @@ -528,4 +530,4 @@ layouts: CURDIR=$(cd $(dirname $0); pwd) BinaryName={{.ServiceName}} echo "$CURDIR/bin/${BinaryName}" - exec $CURDIR/bin/${BinaryName} \ No newline at end of file + exec $CURDIR/bin/${BinaryName} diff --git a/tpl/hertz/server/standard_v2/layout.yaml b/tpl/hertz/server/standard_v2/layout.yaml index d7634ca9..3d6dfdd7 100644 --- a/tpl/hertz/server/standard_v2/layout.yaml +++ b/tpl/hertz/server/standard_v2/layout.yaml @@ -70,7 +70,7 @@ layouts: if conf.GetConf().Hertz.EnablePprof { pprof.Register(h) } - + // gzip if conf.GetConf().Hertz.EnableGzip { h.Use(gzip.Gzip(gzip.DefaultCompression)) @@ -90,8 +90,8 @@ layouts: - path: go.mod delims: - - '{{' - - '}}' + - "{{" + - "}}" body: |- module {{.GoModule}} {{- if .UseApacheThrift}} @@ -232,13 +232,13 @@ layouts: } } - - path: conf/dev/conf.yaml delims: - "" - "" body: |- hertz: + service: "{{.ServiceName}}" address: ":8080" enable_pprof: true enable_gzip: true @@ -264,6 +264,7 @@ layouts: - "" body: |- hertz: + service: "{{.ServiceName}}" address: ":8080" enable_pprof: false enable_gzip: true @@ -289,6 +290,7 @@ layouts: - "" body: |- hertz: + service: "{{.ServiceName}}" address: ":8080" enable_pprof: true enable_gzip: true @@ -308,7 +310,6 @@ layouts: password: "" db: 0 - - path: biz/dal/init.go delims: - "" @@ -512,7 +513,6 @@ layouts: c.JSON(code, data) } - - path: build.sh delims: - "{{" @@ -535,4 +535,4 @@ layouts: CURDIR=$(cd $(dirname $0); pwd) BinaryName={{.ServiceName}} echo "$CURDIR/bin/${BinaryName}" - exec $CURDIR/bin/${BinaryName} \ No newline at end of file + exec $CURDIR/bin/${BinaryName} diff --git a/tpl/kitex/server/standard/conf_tpl.yaml b/tpl/kitex/server/standard/conf_tpl.yaml index 38de9dfe..b1638502 100644 --- a/tpl/kitex/server/standard/conf_tpl.yaml +++ b/tpl/kitex/server/standard/conf_tpl.yaml @@ -43,9 +43,6 @@ body: |- type Kitex struct { Service string `yaml:"service"` Address string `yaml:"address"` - EnablePprof bool `yaml:"enable_pprof"` - EnableGzip bool `yaml:"enable_gzip"` - EnableAccessLog bool `yaml:"enable_access_log"` LogLevel string `yaml:"log_level"` LogFileName string `yaml:"log_file_name"` LogMaxSize int `yaml:"log_max_size"`