caddy-retired/scripts/caddy
David Kebler e24be310ae reworked caddy script - removed cmdline support for netbind
systemd service install now uses sed to insert the repo directory into the call service script before deploying.
renamed install script to fetch as to avoid confusion as it fetches the basic binary.
2020-11-27 15:52:32 -08:00

16 lines
670 B
Bash
Executable file

#!/bin/bash
SDIR=$(dirname "$(readlink -f "$0")") || exit
DIR=$(dirname "$SDIR") || exit
echo Caddy Reposity Root: $DIR
source $SDIR/library
CONF=$DIR/conf/${1:-caddy}.conf
CMD=${2:-run}
get-caddy-bin # this sets $CADDY_BIN
BIN=$DIR/bin/$CADDY_BIN
[ ! -f "$BIN" ] && echo binary file $BIN does not exist && exit 1
[ ! -x "$BIN" ] && echo binary file $BIN is not executable && exit 1
[ ! -f "$CONF" ] && echo no configuration file $CONF && exit 1
# source any need environment files in $DIR/env
for f in $DIR/env/*.env; do source $f; done
echo Running caddy binary $BIN with configuration $CONF and command $CMD as user $USER
$BIN $CMD --config $CONF --adapter caddyfile