From 273d02f4e16a9c2f871c2b5b3a89e60efaffd102 Mon Sep 17 00:00:00 2001 From: Dakota Walsh Date: Tue, 20 Jan 2026 10:27:56 +1300 Subject: [PATCH] Add makefile and openrc init --- Makefile | 34 +++++++++++++++++++++++++++++ README.md | 10 +++++++++ extras/openrc/donation-notification | 18 +++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 extras/openrc/donation-notification diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..19fe58f --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +.POSIX: + +PREFIX ?= /usr +GO ?= go +GOFLAGS ?= -buildvcs=false +RM ?= rm -f + +all: donation-notification + +donation-notification: + $(GO) build $(GOFLAGS) . + +install: all + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f donation-notification $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/donation-notification + +uninstall: + $(RM) $(DESTDIR)$(PREFIX)/bin/donation-notification + +clean: + $(RM) donation-notification + +run: + go run -race . + +watch: + fd -e go -e tmpl | entr -rcs "go run . -config config.toml" + +lint: + fd -e go | entr -c golangci-lint run + +.PHONY: all donation-notification install uninstall clean run watch lint + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6f68e8 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +Listen for donations from paypal and stripe for charleseisenstein.org and send +an email notification. + +## deployment +```sh +doas make install +doas cp extras/openrc/donation-notification /etc/init.d +doas rc-update add donation-notification +doas rc-service donation-notification start +``` diff --git a/extras/openrc/donation-notification b/extras/openrc/donation-notification new file mode 100644 index 0000000..9765711 --- /dev/null +++ b/extras/openrc/donation-notification @@ -0,0 +1,18 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon + +name="donation-notifications" +description="Listen for donations from paypal and stripe" + +command=${command:-/usr/bin/donation-notifications} +command_background=true +command_user="donation-notifications:donation-notifications" + +pidfile="/run/${RC_SVCNAME}.pid" +output_log="/var/log/donation-notifications/output.log" +error_log="/var/log/donation-notifications/output.err" + +depend() { + need net + use dns logger netmount +}