Skip to content

Commit 8d6e72e

Browse files
authored
Merge pull request #258 from thomas-negrault/fix/mongo-restore-authentication-database
Use authentification database in mongorestore
2 parents ebcd4fc + a9037f9 commit 8d6e72e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

install/usr/local/bin/restore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,10 @@ case "${r_dbtype}" in
925925
if [ -n "${r_dbpass}" ] ; then
926926
mongo_pass="-p=${r_dbpass}"
927927
fi
928-
mongorestore ${mongo_compression} -d=${r_dbname} -h=${r_dbhost} --port=${r_dbport} ${mongo_user} ${mongo_pass} --archive=${r_filename}
928+
if [ -n "${DB_AUTH}" ] ; then
929+
mongo_auth_database="--authenticationDatabase=${DB_AUTH}"
930+
fi
931+
mongorestore ${mongo_compression} -d=${r_dbname} -h=${r_dbhost} --port=${r_dbport} ${mongo_user} ${mongo_pass} --archive=${r_filename} ${mongo_auth_database}
929932
exit_code=$?
930933
;;
931934
* )

0 commit comments

Comments
 (0)