🗝
about summary refs log tree commit diff
path: root/example/hook
blob: 291419b0280fcf21e8f7964686a97d0412228e04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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