From ecb0291e1a531d3223793e47f07b0207b688b588 Mon Sep 17 00:00:00 2001 From: mohe2015 Date: Mon, 28 Sep 2020 23:16:43 +0200 Subject: [PATCH] nixos/mongodb: fix running initialScript without a set root password Co-authored-by: Timo Kaufmann --- nixos/modules/services/databases/mongodb.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix index 4453a182990d..4af0b9d44e13 100644 --- a/nixos/modules/services/databases/mongodb.nix +++ b/nixos/modules/services/databases/mongodb.nix @@ -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