1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 21:21:06 +00:00

nixos/mongodb: fix running initialScript without a set root password

Co-authored-by: Timo Kaufmann <timokau@zoho.com>
This commit is contained in:
mohe2015 2020-09-28 23:16:43 +02:00
parent afead527c4
commit ecb0291e1a
No known key found for this signature in database
GPG key ID: 6794D45A488C2EDE

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