获取配置文件代码优化
This commit is contained in:
@@ -11,11 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
consulCfg, err := g.Cfg().Get(context.Background(), "consul.address")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
consulAddr := consulCfg.String()
|
||||
consulAddr := g.Cfg().MustGet(context.Background(), "consul.address").String()
|
||||
registry, err := consul.New(consul.WithAddress(consulAddr))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user