Skip to content

Commit a9037f9

Browse files
Use authentification database in mongorestore
1 parent ebcd4fc commit a9037f9

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)