🗝
about summary refs log tree commit diff
path: root/example/hook
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-04-24 22:44:53 -0700
committermia <mia@mia.jetzt>2024-04-24 22:44:53 -0700
commit7a7bb361396e03707f1f12b10fb61f5d31d91280 (patch)
tree260b69dfa6d5d94810b4c833728e578a9e6a58c3 /example/hook
downloadzoner-7a7bb361396e03707f1f12b10fb61f5d31d91280.tar.gz
zoner-7a7bb361396e03707f1f12b10fb61f5d31d91280.zip
initial commit
Diffstat (limited to 'example/hook')
-rw-r--r--example/hook15
1 files changed, 15 insertions, 0 deletions
diff --git a/example/hook b/example/hook
new file mode 100644
index 0000000..291419b
--- /dev/null
+++ b/example/hook
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# small example hook to purge 1.1.1.1's cache for all touched records
+
+for rec in "$@"; do
+	parts=($rec)
+	op=${parts[0]}
+	type=${parts[1]}
+	name=${parts[2]}
+	if [ "$op" != "create" ]; then
+		continue # only purge for creates
+	fi
+	echo "purge 1.1.1.1 $type $name"
+	curl -X POST "https://one.one.one.one/api/v1/purge?domain=$name&type=$type" | jq -r '.msg'
+done