package utility import ( "app.yhyue.com/moapp/jybase/es" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" ) type esConf struct { Address string `json:"address"` Size int `json:"size"` Version string `json:"version"` UserName string `json:"userName"` Password string `json:"password"` } func init() { var EsConf esConf ctx := gctx.New() _ = g.Cfg().MustGet(ctx, "elasticsearch", "").Scan(&EsConf) es.NewEs(EsConf.Version, EsConf.Address, EsConf.Size, EsConf.UserName, EsConf.Password) g.Log().Info(ctx, "初始化 elasticsearch", EsConf) }