3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #99037 from mohe2015/fix-mongodb

nixos/mongodb: fix running initialScript without a set root password
This commit is contained in:
Timo Kaufmann 2020-12-21 19:41:51 +01:00 committed by GitHub
commit 8aaf788e34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,7 +176,7 @@ in
postStart = ''
if test -e "${cfg.dbpath}/.first_startup"; then
${optionalString (cfg.initialScript != null) ''
${mongodb}/bin/mongo -u root -p ${cfg.initialRootPassword} admin "${cfg.initialScript}"
${mongodb}/bin/mongo ${optionalString (cfg.enableAuth) "-u root -p ${cfg.initialRootPassword}"} admin "${cfg.initialScript}"
''}
rm -f "${cfg.dbpath}/.first_startup"
fi