|
@@ -306,14 +306,15 @@ type MongodbSim struct {
|
|
|
MongodbAddr string
|
|
|
Size int
|
|
|
// MinSize int
|
|
|
- DbName string
|
|
|
- C *mongo.Client
|
|
|
- Ctx context.Context
|
|
|
- ShortCtx context.Context
|
|
|
- pool chan bool
|
|
|
- UserName string
|
|
|
- Password string
|
|
|
- ReplSet string
|
|
|
+ DbName string
|
|
|
+ C *mongo.Client
|
|
|
+ Ctx context.Context
|
|
|
+ ShortCtx context.Context
|
|
|
+ pool chan bool
|
|
|
+ UserName string
|
|
|
+ Password string
|
|
|
+ ReplSet string
|
|
|
+ AuthSource string
|
|
|
}
|
|
|
|
|
|
func (m *MongodbSim) GetMgoConn() *MgoSess {
|
|
@@ -345,8 +346,9 @@ func (m *MongodbSim) InitPool() {
|
|
|
opts.SetMaxPoolSize(uint64(m.Size))
|
|
|
if m.UserName != "" && m.Password != "" {
|
|
|
cre := options.Credential{
|
|
|
- Username: m.UserName,
|
|
|
- Password: m.Password,
|
|
|
+ Username: m.UserName,
|
|
|
+ Password: m.Password,
|
|
|
+ AuthSource: m.AuthSource,
|
|
|
}
|
|
|
opts.SetAuth(cre)
|
|
|
}
|