Skip to content

Commit

Permalink
chore: add service name for hertz and remove kitex unused config (#193)
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <rogers@rogerogers.com>
  • Loading branch information
rogerogers authored Jun 14, 2024
1 parent 2b831c5 commit f95a304
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
30 changes: 16 additions & 14 deletions tpl/hertz/server/standard/layout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -90,8 +90,8 @@ layouts:
- path: go.mod
delims:
- '{{'
- '}}'
- "{{"
- "}}"
body: |-
module {{.GoModule}}
{{- if .UseApacheThrift}}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -232,13 +233,13 @@ layouts:
}
}
- path: conf/dev/conf.yaml
delims:
- ""
- ""
body: |-
hertz:
service: "{{.ServiceName}}"
address: ":8080"
enable_pprof: true
enable_gzip: true
Expand All @@ -264,6 +265,7 @@ layouts:
- ""
body: |-
hertz:
service: "{{.ServiceName}}"
address: ":8080"
enable_pprof: false
enable_gzip: true
Expand All @@ -289,6 +291,7 @@ layouts:
- ""
body: |-
hertz:
service: "{{.ServiceName}}"
address: ":8080"
enable_pprof: true
enable_gzip: true
Expand All @@ -308,7 +311,6 @@ layouts:
password: ""
db: 0
- path: biz/dal/init.go
delims:
- ""
Expand Down Expand Up @@ -528,4 +530,4 @@ layouts:
CURDIR=$(cd $(dirname $0); pwd)
BinaryName={{.ServiceName}}
echo "$CURDIR/bin/${BinaryName}"
exec $CURDIR/bin/${BinaryName}
exec $CURDIR/bin/${BinaryName}
14 changes: 7 additions & 7 deletions tpl/hertz/server/standard_v2/layout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -90,8 +90,8 @@ layouts:
- path: go.mod
delims:
- '{{'
- '}}'
- "{{"
- "}}"
body: |-
module {{.GoModule}}
{{- if .UseApacheThrift}}
Expand Down Expand Up @@ -232,13 +232,13 @@ layouts:
}
}
- path: conf/dev/conf.yaml
delims:
- ""
- ""
body: |-
hertz:
service: "{{.ServiceName}}"
address: ":8080"
enable_pprof: true
enable_gzip: true
Expand All @@ -264,6 +264,7 @@ layouts:
- ""
body: |-
hertz:
service: "{{.ServiceName}}"
address: ":8080"
enable_pprof: false
enable_gzip: true
Expand All @@ -289,6 +290,7 @@ layouts:
- ""
body: |-
hertz:
service: "{{.ServiceName}}"
address: ":8080"
enable_pprof: true
enable_gzip: true
Expand All @@ -308,7 +310,6 @@ layouts:
password: ""
db: 0
- path: biz/dal/init.go
delims:
- ""
Expand Down Expand Up @@ -512,7 +513,6 @@ layouts:
c.JSON(code, data)
}
- path: build.sh
delims:
- "{{"
Expand All @@ -535,4 +535,4 @@ layouts:
CURDIR=$(cd $(dirname $0); pwd)
BinaryName={{.ServiceName}}
echo "$CURDIR/bin/${BinaryName}"
exec $CURDIR/bin/${BinaryName}
exec $CURDIR/bin/${BinaryName}
3 changes: 0 additions & 3 deletions tpl/kitex/server/standard/conf_tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit f95a304

Please sign in to comment.