From b9ac3f73d9de04364f4db4764cf43361e4099397 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Mon, 16 Oct 2023 22:37:51 -0700 Subject: [PATCH] Increment docker-stacks.sh --- homelab/fighter/scripts/docker-stacks.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/homelab/fighter/scripts/docker-stacks.sh b/homelab/fighter/scripts/docker-stacks.sh index be783034..f80e7d4a 100644 --- a/homelab/fighter/scripts/docker-stacks.sh +++ b/homelab/fighter/scripts/docker-stacks.sh @@ -1,5 +1,15 @@ +function initialize { + USER="admin" + HOSTNAME=$(hostname) + STACKS_DIRECTORY="/home/$USER/homelab/$HOSTNAME/config" + + echo "Initialized with:" + echo "USER=$USER" + echo "HOSTNAME=$HOSTNAME" + echo "STACKS_DIRECTORY=$STACKS_DIRECTORY" +} + function main { - STACKS_DIRECTORY="/home/admin/homelab/fighter/config" while [[ $# -gt 0 ]]; do case $1 in # parse global flags @@ -24,7 +34,7 @@ function main { esac done ;; - config*) COMMAND="config"; shift; + config*) COMMAND="docker-compose config"; shift; while [[ $# -gt 0 ]]; do case $1 in -n|--no-interpolate) COMMAND="$COMMAND --no-interpolate"; shift;; @@ -36,7 +46,7 @@ function main { esac done - if [ ! $COMMAND ]; then + if [ -z ${COMMAND+x} ]; then echo "Error: no command specified" exit 1 fi @@ -63,6 +73,5 @@ function main { done } -ARGS="$@" - -main $ARGS \ No newline at end of file +initialize +main "$@" \ No newline at end of file