Skip to content

Commit

Permalink
Merge pull request #321 from pixlise/feature/impersonate-user
Browse files Browse the repository at this point in the history
Fixing logging of db restore/dump process
  • Loading branch information
pnemere authored Sep 16, 2024
2 parents 0bf52c8 + 83d920b commit f941cbd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion api/ws/handlers/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"

"github.com/mongodb/mongo-tools/mongodump"
"github.com/mongodb/mongo-tools/mongorestore"
"github.com/pixlise/core/v4/api/services"
"github.com/pixlise/core/v4/api/ws/wsHelpers"
"github.com/pixlise/core/v4/core/fileaccess"
Expand Down Expand Up @@ -204,7 +205,8 @@ func runRestore(startTimestamp int64, svcs *services.APIServices, downloadRemote
}

if errDBRestore == nil {
restore, errDBRestore := wsHelpers.MakeMongoRestoreInstance(svcs.MongoDetails, svcs.Log, mongoDBConnection.GetDatabaseName("pixlise", svcs.Config.EnvironmentName), restoreFromDBName)
var restore *mongorestore.MongoRestore
restore, errDBRestore = wsHelpers.MakeMongoRestoreInstance(svcs.MongoDetails, svcs.Log, mongoDBConnection.GetDatabaseName("pixlise", svcs.Config.EnvironmentName), restoreFromDBName)

if errDBRestore == nil {
svcs.Log.Infof("Mongo Restore starting...")
Expand Down
2 changes: 1 addition & 1 deletion api/ws/wsHelpers/sync-mongo-dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func MakeMongoDumpInstance(mongoDetails mongoDBConnection.MongoConnectionDetails

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

logger.Infof("MongoDump connecting to: %v, user %v...", connection.Host, auth.Username)
logger.Infof("MongoDump connecting to: %v, user %v, db-to-dump: %v...", connection.Host, auth.Username, dbName)

uri, err := options.NewURI(connectionURI)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion api/ws/wsHelpers/sync-mongo-restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func MakeMongoRestoreInstance(mongoDetails mongoDBConnection.MongoConnectionDeta
protocolPrefix := "mongodb://"
connection.Host = strings.TrimPrefix(connection.Host, protocolPrefix)

logger.Infof("MongoRestore connecting to: %v, user %v...", connection.Host, auth.Username)
logger.Infof("MongoRestore connecting to: %v, user %v, restore-to-db: %v, restore-from-db: %v...", connection.Host, auth.Username, restoreToDBName, restoreFromDBName)

retryWrites := false

Expand Down

0 comments on commit f941cbd

Please sign in to comment.