error
This commit is contained in:
parent
0256266107
commit
b0f2cf46eb
@ -44,8 +44,6 @@ func (m *MongoDB) Init(collections []string, config MongoConf) {
|
||||
ResourceMap = make(map[string]interface{})
|
||||
|
||||
m.Logger.Info().Msg("Connecting to" + config.GetUrl())
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
mngoCollections = collections
|
||||
mngoConfig = config
|
||||
if err := m.createClient(config.GetUrl()); err == nil {
|
||||
@ -72,6 +70,8 @@ func (m *MongoDB) createClient(MongoURL string) error {
|
||||
UseJSONStructTags: true,
|
||||
NilSliceAsEmpty: true,
|
||||
}
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
clientOptions := options.Client().ApplyURI(MongoURL).SetBSONOptions(bsonOpts)
|
||||
mngoClient, err = mongo.Connect(MngoCtx, clientOptions)
|
||||
|
Loading…
Reference in New Issue
Block a user