aboutsummaryrefslogtreecommitdiffstats
path: root/example-hook.sh.in
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-06-04 10:42:19 +0100
committerLexi Winter <ivy@FreeBSD.org>2025-06-04 10:56:04 +0100
commit15010d062ae276a92065cd6ea7dc94b749e20756 (patch)
tree8745f89f933826afbb329b4fc447186a1200610d /example-hook.sh.in
parent09aa3870070960d37d7bdbb724f4ac7b68395fdf (diff)
downloadlfacme-15010d062ae276a92065cd6ea7dc94b749e20756.tar.gz
lfacme-15010d062ae276a92065cd6ea7dc94b749e20756.tar.bz2
allow PREFIX to be customised
Diffstat (limited to 'example-hook.sh.in')
-rw-r--r--example-hook.sh.in27
1 files changed, 27 insertions, 0 deletions
diff --git a/example-hook.sh.in b/example-hook.sh.in
new file mode 100644
index 0000000..64e0252
--- /dev/null
+++ b/example-hook.sh.in
@@ -0,0 +1,27 @@
+#! /bin/sh
+# This source code is released into the public domain.
+#
+# An example hook.
+
+# Action is always 'newcert', at least for now.
+action="$1"
+
+# Environment variables:
+# $LFACME_CERT is the name of the certificate
+# $LFACME_CERTFILE is the filename of the certificate.
+# $LFACME_KEYFILE is the filename of the private key.
+
+set -e
+
+case "$action" in
+newcert)
+ # The certificate was issued or renewed.
+ cp "$LFACME_CERTFILE" __PREFIX__/etc/nginx/tls/cert.pem
+ cp "$LFACME_KEYFILE" __PREFIX__/etc/nginx/tls/key.pem
+ nginx -s reload
+ ;;
+
+*)
+ # Ignore unknown actions, because new ones might be added later.
+ ;;
+esac