modify run to accept a subdirectory, so can be compatible with editor files in same project directory

master
David Kebler 2021-01-17 16:43:24 -08:00
parent ae1d9f73b7
commit c56f3caf49
1 changed files with 3 additions and 2 deletions

5
run
View File

@ -15,15 +15,16 @@ else
echo warning no environoment file set for $1 in $RDIR/sites echo warning no environoment file set for $1 in $RDIR/sites
fi fi
DATA_DIR=${DATA_DIR:-${HOME}/.local/hugo} DATA_DIR=${DATA_DIR:-${HOME}/.local/hugo}
DATA_DIR=${DATA_DIR}/${1}$([[ $DATA_SUB_DIR ]] && echo "/$DATA_SUB_DIR")
HUGO=${HUGO:-$(command -v hugo)} HUGO=${HUGO:-$(command -v hugo)}
PORT=${PORT:-8096} PORT=${PORT:-8096}
echo site files in $DATA_DIR/$1 listening on port $PORT echo site files in $DATA_DIR listening on port $PORT
# [[ $(netstat -tulpn | grep LISTEN | grep 0.0.0.0:$PORT) ]] && echo tcp port $PORT is busy can not start hugo server && exit # [[ $(netstat -tulpn | grep LISTEN | grep 0.0.0.0:$PORT) ]] && echo tcp port $PORT is busy can not start hugo server && exit
CMD="$HUGO server CMD="$HUGO server
$([[ $BASE_URL = "https://"* ]] && echo " --liveReloadPort 443") $([[ $BASE_URL = "https://"* ]] && echo " --liveReloadPort 443")
--bind 0.0.0.0 --bind 0.0.0.0
--themesDir $RDIR/themes --themesDir $RDIR/themes
--source $DATA_DIR/$1 --source $DATA_DIR
--port $PORT --port $PORT
--appendPort=$([[ $REVERSE_PROXY = true ]] && echo false || echo true) --appendPort=$([[ $REVERSE_PROXY = true ]] && echo false || echo true)
--baseURL ${BASE_URL:-localhost} --baseURL ${BASE_URL:-localhost}