17 lines
670 B
Bash
Executable File
17 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
|