🗝
about summary refs log tree commit diff
path: root/example/hook
diff options
context:
space:
mode:
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