fmt and formatting; nsd-acme is less verbose

This commit is contained in:
Motiejus Jakštys 2023-08-10 10:48:34 +03:00
parent fa435f65d0
commit a2a741d27e

View File

@ -16,7 +16,7 @@
NOW=$(date +%y%m%d%H%M) NOW=$(date +%y%m%d%H%M)
DIR="/var/lib/nsd/acmezones" DIR="/var/lib/nsd/acmezones"
[ "$TYPE" != "dns-01" ] && { echo "Skipping $TYPE"; exit 1; } [ "$TYPE" != "dns-01" ] && { exit 1; }
write_zone() { write_zone() {
cat <<EOF cat <<EOF
@ -36,19 +36,14 @@
case "$METHOD" in case "$METHOD" in
begin) begin)
echo "Deleting previous ${fullZone} if exists ..."
nsd-control delzone ${fullZone} || : nsd-control delzone ${fullZone} || :
write_zone > "$DIR/${fullZone}.zone" write_zone > "$DIR/${fullZone}.zone"
echo "Activating ${fullZone}"
nsd-control addzone ${fullZone} acme nsd-control addzone ${fullZone} acme
;; ;;
done) done)
echo "ACME request successful, cleaning up"
cleanup cleanup
;; ;;
failed) failed)
echo "ACME request failed, cleaning up"
cleanup cleanup
;; ;;
esac esac
@ -86,9 +81,7 @@ in {
zonefile: "/var/lib/nsd/acmezones/%s.zone" zonefile: "/var/lib/nsd/acmezones/%s.zone"
''; '';
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = ["d /var/lib/nsd/acmezones 0755 nsd nsd -"];
"d /var/lib/nsd/acmezones 0755 nsd nsd -"
];
systemd.services = systemd.services =
{ {
@ -203,7 +196,7 @@ in {
lib.mkIf config.mj.base.unitstatus.enable lib.mkIf config.mj.base.unitstatus.enable
( (
["nsd-control-setup"] ["nsd-control-setup"]
++ map (n: "nsd-acme-${n}") ++ map (z: "nsd-acme-${z}")
(lib.attrNames config.mj.services.nsd-acme.zones) (lib.attrNames config.mj.services.nsd-acme.zones)
); );
}; };