From 7a7bb361396e03707f1f12b10fb61f5d31d91280 Mon Sep 17 00:00:00 2001 From: mia Date: Wed, 24 Apr 2024 22:44:53 -0700 Subject: initial commit --- example/hook | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 example/hook (limited to 'example/hook') 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 -- cgit 1.4.1