From 0ea557bdfd793dfd34ea00f7fa596d46a215d17f Mon Sep 17 00:00:00 2001 From: Abigail G Date: Fri, 3 Sep 2021 00:49:27 -0400 Subject: [PATCH] New package: webhook-2.8.0 --- srcpkgs/webhook/files/webhook/conf | 122 ++++++++++++++++++++++++++ srcpkgs/webhook/files/webhook/log/run | 2 + srcpkgs/webhook/files/webhook/run | 37 ++++++++ srcpkgs/webhook/template | 21 +++++ 4 files changed, 182 insertions(+) create mode 100644 srcpkgs/webhook/files/webhook/conf create mode 100644 srcpkgs/webhook/files/webhook/log/run create mode 100644 srcpkgs/webhook/files/webhook/run create mode 100644 srcpkgs/webhook/template diff --git a/srcpkgs/webhook/files/webhook/conf b/srcpkgs/webhook/files/webhook/conf new file mode 100644 index 000000000000..2bb5a43a85f8 --- /dev/null +++ b/srcpkgs/webhook/files/webhook/conf @@ -0,0 +1,122 @@ +# A list of paths to json files containing defined hooks webhook should serve. +# Each filepath should be separated by whitespace, and quoted if needed. +# +# Default: /etc/webhook/hooks.json +# +# HOOKS_FILES="/etc/webhook/hooks.json" + +# Parse hooks files as Go templates +# +# Default: false +# +# TEMPLATE=false + +# Watch hooks file for changes and reload them automatically +# +# Default: true +# +# HOTRELOAD=true + +# IP webhook should serve hooks on +# +# Default: "0.0.0.0" +# +# IP="0.0.0.0" + +# Port the webhook should serve hooks on +# +# Default: 9000 +# +# PORT=9000 + +# URL prefix to use for served hooks (protocol://yourserver:port/PREFIX/:hook-id) +# +# Default: "hooks" +# +# PREFIX="hooks" + +# Set default allowed HTTP methods (ie. "POST") +# Separate methods with comma +# +# Default: "POST" +# +# HTTP_METHODS="POST" + +# Response header to return, specified in format name=value. +# To set multiple headers, separate each by whitespace, and quote if necessary +# +# Default: "" +# +# HEADERS="" + +# Use X-Request-Id header, if present, as request ID +# +# Default: false +# +# X_REQUEST_ID=false + +# Truncate X-Request-Id header to limit; default no limit +# +# Default: "" +# +# X_REQUEST_ID_LIMIT="" + +# Maximum memory in bytes for parsing multipart form data before disk caching +# +# Default: 1048576 +# +# MAX_MULTIPART_MEM=1048576 + +# Use HTTPS instead of HTTP +# +# Default: false +# +# SECURE=false + +# Path to the HTTPS certificate pem file +# +# Default: "" +# +# CERT="/etc/webhook/cert.pem" + +# Path to the HTTPS private key pem file +# +# Default: "" +# +# KEY="/etc/webhook/key.pem" + +# Comma-separated list of supported TLS cipher suites +# +# Default: "" +# +# CIPHER_SUITES="" + +# Minimum TLS version (1.0, 1.1, 1.2, 1.3) +# +# Default: "1.2" +# +# TLS_MIN_VERSION="1.2" + +# Do not panic if hooks cannot be loaded when webhook is not running in verbose mode +# +# Default: false +# +# NOPANIC=false + +# Show verbose output +# +# Default: true +# +# VERBOSE=true + +# Show debug output +# +# Default: false +# +# DEBUG=false + +# Set other options that aren't set above +# +# Default: "" +# +# OTHER_OPTS="" diff --git a/srcpkgs/webhook/files/webhook/log/run b/srcpkgs/webhook/files/webhook/log/run new file mode 100644 index 000000000000..700bf023a873 --- /dev/null +++ b/srcpkgs/webhook/files/webhook/log/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec vlogger -p daemon.info -t webhook diff --git a/srcpkgs/webhook/files/webhook/run b/srcpkgs/webhook/files/webhook/run new file mode 100644 index 000000000000..470fd3ec9127 --- /dev/null +++ b/srcpkgs/webhook/files/webhook/run @@ -0,0 +1,37 @@ +#!/bin/sh +exec 2>&1 + +[ -r conf ] && . ./conf + +OPTS="" + +[ "$TEMPLATE" = "true" ] && OPTS="$OPTS -template" +[ "$X_REQUEST_ID" = "true" ] && OPTS="$OPTS -x-request-id" +[ "$SECURE" = "true" ] && OPTS="$OPTS -secure" +[ "$NOPANIC" = "true" ] && OPTS="$OPTS -nopanic" +[ "$DEBUG" = "true" ] && OPTS="$OPTS -debug" + +if [ "$HOTRELOAD" = "true" ] || [ -z "$HOTRELOAD" ]; then OPTS="$OPTS -hotreload"; fi +if [ "$VERBOSE" = "true" ] || [ -z "$VERBOSE" ]; then OPTS="$OPTS -verbose"; fi + +[ -n "$IP" ] && OPTS="$OPTS -ip $IP" +[ -n "$PORT" ] && OPTS="$OPTS -port $PORT" +[ -n "$PREFIX" ] && OPTS="$OPTS -urlprefix $PREFIX" +[ -n "$HTTP_METHODS" ] && OPTS="$OPTS -http-methods $HTTP_METHODS" +[ -n "$X_REQUEST_ID_LIMIT" ] && OPTS="$OPTS -x-request-id-limit $X_REQUEST_ID_LIMIT" +[ -n "$MAX_MULTIPART_MEM" ] && OPTS="$OPTS -max-multipart-mem $MAX_MULTIPART_MEM" +[ -n "$CERT" ] && OPTS="$OPTS -cert $CERT" +[ -n "$KEY" ] && OPTS="$OPTS -key $KEY" +[ -n "$CIPHER_SUITES" ] && OPTS="$OPTS -cipher-suites $CIPHER_SUITES" +[ -n "$TLS_MIN_VERSION" ] && OPTS="$OPTS -tls-min-version $TLS_MIN_VERSION" + +[ -z "$HOOKS_FILES" ] && HOOKS_FILES="/etc/webhook/hooks.json" +for f in $HOOKS_FILES; do + OPTS="$OPTS -hooks $f" +done + +for h in $HEADERS; do + OPTS="$OPTS -header $h" +done + +exec webhook $OPTS $OTHER_OPTS -pidfile /run/webhook.pid diff --git a/srcpkgs/webhook/template b/srcpkgs/webhook/template new file mode 100644 index 000000000000..cb8e75eadde5 --- /dev/null +++ b/srcpkgs/webhook/template @@ -0,0 +1,21 @@ +# Template file for 'webhook' +pkgname=webhook +version=2.8.0 +revision=1 +build_style=go +go_import_path="github.com/adnanh/webhook" +make_dirs="/etc/webhook 0644 root root" +short_desc="Lightweight incoming webhook server to run shell commands" +maintainer="Abigail G " +license="MIT" +homepage="https://github.com/adnanh/webhook" +distfiles="https://github.com/adnanh/webhook/archive/${version}.tar.gz" +checksum=c521558083f96bcefef16575a6f3f98ac79c0160fd0073be5e76d6645e068398 + +post_install() { + vlicense LICENSE + vsv webhook + + for f in docs/*.md; do vdoc $f; done + for f in *.example; do vsconf $f ${f%.example}; done +}