Skip to content

Commit 62daab1

Browse files
authored
[type: refactor] optimize config (acmestack#63)
1 parent 23dfbf6 commit 62daab1

File tree

6 files changed

+5
-6
lines changed

6 files changed

+5
-6
lines changed

config/envcd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ storage:
66
server:
77
read-timeout: 60
88
write-timeout: 60
9-
http-port: 8000
9+
port: 8080
1010
run-mode: debug

internal/core/exchanger/exchange.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type Exchanger interface {
3636
Remove(key interface{}) error
3737
}
3838

39+
// Exchange the envcd data exchange
3940
type Exchange struct {
4041
exchanger Exchanger
4142
}
File renamed without changes.

internal/core/openapi/openapi.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,17 @@ func Start(serverSetting *config.Server, exchange *exchanger.Exchange, storage *
5656
func (openapi *Openapi) initServer(serverSetting *config.Server) {
5757
gin.SetMode(serverSetting.RunMode)
5858
server := &http.Server{
59-
Addr: fmt.Sprintf(":%d", serverSetting.HttpPort),
59+
Addr: fmt.Sprintf(":%d", serverSetting.Port),
6060
Handler: openapi.buildRouter(),
6161
ReadTimeout: time.Duration(serverSetting.ReadTimeout),
6262
WriteTimeout: time.Duration(serverSetting.WriteTimeout),
6363
MaxHeaderBytes: 1 << 20,
6464
}
6565

6666
log.Info("start http server listening %s", server.Addr)
67-
6867
err := server.ListenAndServe()
6968
if err != nil {
70-
log.Error("service error %v", err)
71-
return
69+
log.Error("start http server error %v", err)
7270
}
7371
}
7472

internal/pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type Storage struct {
4848
// Server the Server config
4949
type Server struct {
5050
RunMode string `yaml:"run-mode"`
51-
HttpPort int `yaml:"http-port"`
51+
Port int `yaml:"port"`
5252
ReadTimeout int `yaml:"read-timeout"`
5353
WriteTimeout int `yaml:"write-timeout"`
5454
}

0 commit comments

Comments
 (0)