获取配置文件代码优化

This commit is contained in:
2025-11-28 14:01:08 +08:00
parent ab7d3de666
commit 7e2884414d
5 changed files with 13 additions and 23 deletions

View File

@@ -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)