From a9037f97acd7ae8c04c158ee144c5050e09a5632 Mon Sep 17 00:00:00 2001 From: Thomas Negrault Date: Wed, 11 Oct 2023 22:57:29 +0200 Subject: [PATCH] Use authentification database in mongorestore --- install/usr/local/bin/restore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/usr/local/bin/restore b/install/usr/local/bin/restore index d08c61d..efa97fe 100755 --- a/install/usr/local/bin/restore +++ b/install/usr/local/bin/restore @@ -925,7 +925,10 @@ case "${r_dbtype}" in if [ -n "${r_dbpass}" ] ; then mongo_pass="-p=${r_dbpass}" fi - mongorestore ${mongo_compression} -d=${r_dbname} -h=${r_dbhost} --port=${r_dbport} ${mongo_user} ${mongo_pass} --archive=${r_filename} + if [ -n "${DB_AUTH}" ] ; then + mongo_auth_database="--authenticationDatabase=${DB_AUTH}" + fi + mongorestore ${mongo_compression} -d=${r_dbname} -h=${r_dbhost} --port=${r_dbport} ${mongo_user} ${mongo_pass} --archive=${r_filename} ${mongo_auth_database} exit_code=$? ;; * )