~sircmpwn/sr.ht-packages

hg.sr.ht-deb: Add GraphQL API v1 PROPOSED

Peter Sanchez: 1
 Add GraphQL API

 5 files changed, 20 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/sr.ht-packages/patches/29522/mbox | git am -3
Learn more about email & git

[PATCH hg.sr.ht-deb] Add GraphQL API Export this patch

# HG changeset patch
# User Peter Sanchez <peter@netlandish.com>
# Date 1645051197 21600
#      Wed Feb 16 16:39:57 2022 -0600
# Node ID b48a2faef25007557c3846811a6d4952e697208c
# Parent  a834e88829f173d439f0cfca106a67d14e0acc99
Add GraphQL API
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -16,11 +16,14 @@ override_dh_auto_build:
	make SRHT_PATH=${SRHT_PATH}
	dh_auto_build
	cd hgsrht-keys && go build
	cd api && go build -o hgsrht-api

override_dh_installsystemd:
	dh_installsystemd
	dh_installsystemd --name srht-hg-webhooks
	dh_installsystemd --name srht-hg-api

override_dh_auto_clean:
	dh_auto_clean
	-rm hgsrht-keys/hgsrht-keys
	-rm api/hgsrht-api
diff --git a/debian/srht-hg.install b/debian/srht-hg.install
--- a/debian/srht-hg.install
+++ b/debian/srht-hg.install
@@ -1,2 +1,3 @@
hgsrht-keys/hgsrht-keys usr/bin/
hgsrht/hgrcs etc/sr.ht/
api/hgsrht-api usr/bin
diff --git a/debian/srht-hg.postinst b/debian/srht-hg.postinst
--- a/debian/srht-hg.postinst
+++ b/debian/srht-hg.postinst
@@ -14,6 +14,8 @@ case "$1" in
        usermod --shell /bin/sh ${USER}
        touch /var/log/hgsrht-shell
        chown ${USER}: /var/log/hgsrht-shell
        touch /var/log/hg.sr.ht-api.log
        chown ${USER}: /var/log/hg.sr.ht-api.log
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/srht-hg.postrm b/debian/srht-hg.postrm
--- a/debian/srht-hg.postrm
+++ b/debian/srht-hg.postrm
@@ -5,6 +5,7 @@ set -e
case "$1" in
    purge)
        rm -f /var/log/hg-srht-shell
        rm -f /var/log/hg.sr.ht-api.log
    ;;

    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
diff --git a/debian/srht-hg.srht-hg-api.service b/debian/srht-hg.srht-hg-api.service
new file mode 100644
--- /dev/null
+++ b/debian/srht-hg.srht-hg-api.service
@@ -0,0 +1,13 @@
[Unit]
Description=hg.sr.ht API service
Requires=redis-server.service postgresql.service
After=redis-server.service postgresql.service network.target

[Service]
Type=simple
User=hgsrht
Restart=always
ExecStart=/usr/bin/hgsrht-api -b :5110

[Install]
WantedBy=multi-user.target
Peter Sanchez a écrit :
(Having a second look.)