nixos/openldap: Add delcarativeConfig by suffix

Adding by index could be an issue if the user wanted the data to be
added to a DB other than the first.
This commit is contained in:
Kai Wohlfahrt 2020-08-16 20:17:06 +01:00
parent 1fde3c3561
commit 057cb570be

View file

@ -474,14 +474,14 @@ in {
${openldap}/bin/slaptest -f ${configFile} -F ${configDir} || true
'' else ''
rm -Rf '${configDir}'/*
${openldap}/bin/slapadd -F ${configDir} -n0 -l ${settingsFile}
${openldap}/bin/slapadd -F ${configDir} -bcn=config -l ${settingsFile}
''
)}
chown -R "${cfg.user}:${cfg.group}" '${configDir}'
${optionalString (cfg.declarativeContents != null) ''
rm -Rf '${lib.head dataDirs}'/*
${openldap}/bin/slapadd -F ${configDir} -n1 -l ${dataFile}
${openldap}/bin/slapadd -F ${configDir} -b${cfg.suffix} -l ${dataFile}
chown -R "${cfg.user}:${cfg.group}" ${lib.escapeShellArgs dataDirs}
''}