Skip to content

Commit

Permalink
Merge pull request #313 from pixlise/feature/impersonate-user
Browse files Browse the repository at this point in the history
Mongo dump/restore document DB connection fixes
  • Loading branch information
pnemere authored Sep 16, 2024
2 parents b29b0c8 + a6460ae commit 0e220c0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/ws/wsHelpers/sync-mongo-dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,28 @@ func MakeMongoDumpInstance(mongoDetails mongoDBConnection.MongoConnectionDetails
protocolPrefix := "mongodb://"
connection.Host = strings.TrimPrefix(connection.Host, protocolPrefix)

connectionURI := fmt.Sprintf("mongodb://%s/%s", connection.Host, "")

passSeg := ""
if len(auth.Password) > 5 {
passSeg = auth.Password[0:5]
}
logger.Infof("MongoDump connecting to: %v, user %v, pass %v...", connection.Host, auth.Username, passSeg)

uri, err := options.NewURI(connectionURI)
if err != nil {
logger.Errorf("%v", err)
return nil
}

toolOptions = &options.ToolOptions{
SSL: &ssl,
Connection: connection,
Auth: &auth,
Verbosity: &options.Verbosity{},
URI: &options.URI{},
URI: uri, /*&options.URI{
ConnectionString: connectionURI,
},*/
}

toolOptions.Namespace = &options.Namespace{DB: dbName}
Expand Down

0 comments on commit 0e220c0

Please sign in to comment.