shell-host/containers/caddy.inst

24 lines
632 B
Plaintext
Raw Normal View History

caddy_install () {
local target
local dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
target=${1:-/opt/caddy}
[[ -d $target ]] || mkdir -p $target
echo installing caddy to $target
if /bin/cp -r -f $dir/caddy/* $target; then
pushd $target || return
echo CADDY_DIR=$target >> .env
cp example.env .env
source .env
2024-04-10 11:25:59 -07:00
cp conf/example.conf conf/$CONF.conf
./config
else
echo unable to copy caddy files to $target, install aborted
fi
popd || return
}
# if script was executed then call the function
(return 0 2>/dev/null) || caddy_install $@