We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ded822d commit f321da8Copy full SHA for f321da8
ābackup.shā
@@ -11,16 +11,8 @@ mkdir -p $BACKUP_PATH
11
12
echo "Starting MongoDB backup at $(date)..."
13
14
-# Build authentication options
15
-AUTH_OPTS=""
16
-if [ -n "$MONGODB_USERNAME" ] && [ -n "$MONGODB_PASSWORD" ]; then
17
- AUTH_OPTS="--username=$MONGODB_USERNAME --password=$MONGODB_PASSWORD --authenticationDatabase=$MONGODB_AUTH_DB"
18
-fi
19
-
20
-# Run mongodump to backup all databases and collections
21
-mongodump --host=$MONGODB_HOST \
22
- --port=$MONGODB_PORT \
23
- $AUTH_OPTS \
+# Run mongodump using the connection string from environment
+mongodump --uri="$MONGODB_URI" \
24
--out=$BACKUP_PATH
25
26
echo "MongoDB dump completed."
0 commit comments