Skip to content

Commit

Permalink
Got local DB restore/dump working
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Nemere committed Sep 16, 2024
1 parent 2ec46f5 commit d057610
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 10 additions & 4 deletions api/ws/wsHelpers/sync-mongo-dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ var dataBackupS3Path = "DB"
func MakeMongoDumpInstance(mongoDetails mongoDBConnection.MongoConnectionDetails, logger logger.ILogger, dbName string) *mongodump.MongoDump {
var toolOptions *options.ToolOptions

ssl := options.SSL{
UseSSL: true,
SSLCAFile: "./global-bundle.pem",
SSLPEMKeyFile: "./global-bundle.pem",
ssl := options.SSL{}

isLocal := strings.Contains(mongoDetails.Host, "localhost") && len(mongoDetails.User) <= 0 && len(mongoDetails.Password) <= 0

if !isLocal {
ssl = options.SSL{
UseSSL: true,
SSLCAFile: "./global-bundle.pem",
SSLPEMKeyFile: "./global-bundle.pem",
}
}

auth := options.Auth{
Expand Down
14 changes: 10 additions & 4 deletions api/ws/wsHelpers/sync-mongo-restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ import (
func MakeMongoRestoreInstance(mongoDetails mongoDBConnection.MongoConnectionDetails, logger logger.ILogger, restoreToDBName string, restoreFromDBName string) (*mongorestore.MongoRestore, error) {
var toolOptions *options.ToolOptions

ssl := options.SSL{
UseSSL: true,
SSLCAFile: "./global-bundle.pem",
SSLPEMKeyFile: "./global-bundle.pem",
ssl := options.SSL{}

isLocal := strings.Contains(mongoDetails.Host, "localhost") && len(mongoDetails.User) <= 0 && len(mongoDetails.Password) <= 0

if !isLocal {
ssl = options.SSL{
UseSSL: true,
SSLCAFile: "./global-bundle.pem",
SSLPEMKeyFile: "./global-bundle.pem",
}
}

auth := options.Auth{
Expand Down

0 comments on commit d057610

Please sign in to comment.