#!/sbin/openrc-run # Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 description="Puppet Webhook API server written in Go." command="/usr/bin/webhook-go" command_background="yes" pidfile="/run/${RC_SVCNAME}.pid" : ${WEBHOOK_ARGS:="--config /etc/voxpupuli/webhook.yml"} depend() { need net } start_pre() { checkpath --directory --owner root:root --mode 0755 /run checkpath --directory --owner root:root --mode 0755 /var/log checkpath --file --owner root:root --mode 0644 /var/log/${RC_SVCNAME}.log checkpath --file --owner root:root --mode 0644 /var/log/${RC_SVCNAME}.err } start() { ebegin "Starting ${RC_SVCNAME}" start-stop-daemon --start \ --exec ${command} \ --background \ --make-pidfile \ --pidfile ${pidfile} \ --stdout /var/log/${RC_SVCNAME}.log \ --stderr /var/log/${RC_SVCNAME}.err \ --env GIN_MODE=release \ -- server ${WEBHOOK_ARGS} eend $? } stop() { ebegin "Stopping ${RC_SVCNAME}" start-stop-daemon --stop --pidfile ${pidfile} eend $? } reload() { ebegin "Reloading ${RC_SVCNAME}" start-stop-daemon --signal HUP --pidfile ${pidfile} eend $? }