diff options
author | Wynn Wolf Arbor | 2020-01-13 15:59:49 +0100 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-01-13 15:59:49 +0100 |
commit | 90b60b5044587535e792ed5410acbf10a76963e7 (patch) | |
tree | 316d681581cb2b3a4218f31e72cab376e70b8252 /www-servers/caddy-bin/files | |
download | pramantha-90b60b5044587535e792ed5410acbf10a76963e7.tar.gz |
Initial import
Diffstat (limited to 'www-servers/caddy-bin/files')
-rw-r--r-- | www-servers/caddy-bin/files/caddy.confd | 4 | ||||
-rw-r--r-- | www-servers/caddy-bin/files/caddy.initd | 48 |
2 files changed, 52 insertions, 0 deletions
diff --git a/www-servers/caddy-bin/files/caddy.confd b/www-servers/caddy-bin/files/caddy.confd new file mode 100644 index 0000000..ae77de2 --- /dev/null +++ b/www-servers/caddy-bin/files/caddy.confd @@ -0,0 +1,4 @@ +CADDYPATH="/var/lib/caddy" +CADDY_CONFIG="/etc/caddy/Caddyfile" +CADDY_OPTS="-agree=true -conf=${CADDY_CONFIG}" +rc_ulimit="-n 8192" diff --git a/www-servers/caddy-bin/files/caddy.initd b/www-servers/caddy-bin/files/caddy.initd new file mode 100644 index 0000000..c0112d3 --- /dev/null +++ b/www-servers/caddy-bin/files/caddy.initd @@ -0,0 +1,48 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +name="${RC_SVCNAME}" +extra_commands="configtest" +extra_started_commands="reload" +description_configtest="Run Caddy's internal config check" +description_reload="Reload Caddy configuration" + +export CADDYPATH="${CADDYPATH}" +command="caddy" +command_args="${CADDY_OPTS}" +command_user="${command_user:-caddy:http}" +command_background=yes +pidfile="/run/${RC_SVCNAME}.pid" + +depend() { + use net + after dns +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +reload() { + configtest || return 1 + ebegin "Refreshing ${name}'s configuration" + start-stop-daemon --signal USR1 --pidfile "${pidfile}" + eend $? "Failed to reload ${name}" +} + +configtest() { + ebegin "Checking ${name} configuration" + if ! ${command} -validate -conf="${CADDY_CONFIG}" >/dev/null 2>&1; then + ${command} -validate -conf="${CADDY_CONFIG}" + fi + eend $? "Failed, please correct the errors above" +} |