package mgodb import ( "encoding/json" "eta/eta_forum_admin/utils" "eta/eta_forum_admin/utils/mgodb" ) func init() { if utils.MgoUrlData != `` { var mgoConfig mgodb.MgoConfig if e := json.Unmarshal([]byte(utils.MgoUrlData), &mgoConfig); e != nil { panic("mongodb链接失败,Err:" + e.Error()) return } mgoCli := mgodb.NewMgoClient(mgoConfig) utils.MgoDataCli = mgoCli utils.MgoDataDbName = mgoConfig.Database } }