fix nextcloud: fail if secrets are missing

This commit is contained in:
Alexander Tomokhov 2023-12-27 15:05:23 +04:00
parent 77619456d7
commit fe44ba6fd8

View file

@ -35,12 +35,15 @@
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
path = with pkgs; [ coreutils jq ]; path = with pkgs; [ coreutils jq ];
script = '' script = ''
databasePassword=$(jq -re '.modules.nextcloud.databasePassword' ${secrets-filepath})
adminPassword=$(jq -re '.modules.nextcloud.adminPassword' ${secrets-filepath})
install -C -m 0440 -o nextcloud -g nextcloud -DT \ install -C -m 0440 -o nextcloud -g nextcloud -DT \
<(jq -re '.modules.nextcloud.databasePassword' ${secrets-filepath}) \ <(printf "%s\n" "$databasePassword") \
${db-pass-filepath} ${db-pass-filepath}
install -C -m 0440 -o nextcloud -g nextcloud -DT \ install -C -m 0440 -o nextcloud -g nextcloud -DT \
<(jq -re '.modules.nextcloud.adminPassword' ${secrets-filepath}) \ <(printf "%s\n" "$adminPassword") \
${admin-pass-filepath} ${admin-pass-filepath}
''; '';
}; };