From 0b5fea7b71ffe88b2ccf3f4643eeeffd45f8d42c Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 25 Apr 2025 12:59:06 +1200 Subject: [PATCH] Tidy --- templates/example/example/service.env | 2 +- templates/watchtower/_basic.env | 13 +++++++++++++ templates/watchtower/_common.sh | 9 ++++++--- templates/watchtower/example/service.env | 8 -------- templates/watchtower/{_install.sh => install.sh} | 0 .../watchtower/{_uninstall.sh => uninstall.sh} | 0 6 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 templates/watchtower/_basic.env rename templates/watchtower/{_install.sh => install.sh} (100%) rename templates/watchtower/{_uninstall.sh => uninstall.sh} (100%) diff --git a/templates/example/example/service.env b/templates/example/example/service.env index e93d8b9..f9d95ae 100644 --- a/templates/example/example/service.env +++ b/templates/example/example/service.env @@ -1,5 +1,5 @@ # Service settings specific to this server -# (can also override anything in the basic.env file in the template to make it specific to this server) +# (can also override anything in the _basic.env file in the template to make it specific to this server) HOST_PORT=80 LOCAL_DATA_FOLDER="${HOME}/.example" diff --git a/templates/watchtower/_basic.env b/templates/watchtower/_basic.env new file mode 100644 index 0000000..8438555 --- /dev/null +++ b/templates/watchtower/_basic.env @@ -0,0 +1,13 @@ +# Service settings +TEMPLATE=watchtower + +CONTAINER_NAME=watchtower + +# Interval in seconds between checks. +# Default is 1800 seconds (30 minutes). +INTERVAL=1800 + +# Image settings +IMAGE_REGISTRY="docker.io" +IMAGE_REPO="containrrr/watchtower" +IMAGE_TAG="latest" diff --git a/templates/watchtower/_common.sh b/templates/watchtower/_common.sh index a23a529..6a5d2cf 100755 --- a/templates/watchtower/_common.sh +++ b/templates/watchtower/_common.sh @@ -4,6 +4,9 @@ # JDE # 2025-04-25 +# This file is not required if you write your own template. + + # Print error message and exit with code 1 # Usage: die "error message" die() { @@ -19,12 +22,12 @@ load_env() { local env_file # first load basic.env for the template defaults - if [ -f "$script_dir/basic.env" ]; then + if [ -f "$script_dir/_basic.env" ]; then set -a - source "$script_dir/basic.env" + source "$script_dir/_basic.env" set +a else - echo "Warning: basic.env file not found at $script_dir/basic.env. Broken template?" + echo "Warning: basic.env file not found at $script_dir/_basic.env. Broken template?" return 1 fi diff --git a/templates/watchtower/example/service.env b/templates/watchtower/example/service.env index 3577c8b..769b305 100644 --- a/templates/watchtower/example/service.env +++ b/templates/watchtower/example/service.env @@ -1,14 +1,6 @@ # Service settings -TEMPLATE=watchtower - -CONTAINER_NAME=watchtower # Interval in seconds between checks. # Default is 1800 seconds (30 minutes). INTERVAL=1800 -# Image settings -IMAGE_REGISTRY="docker.io" -IMAGE_REPO="containrrr/watchtower" -IMAGE_TAG="latest" - diff --git a/templates/watchtower/_install.sh b/templates/watchtower/install.sh similarity index 100% rename from templates/watchtower/_install.sh rename to templates/watchtower/install.sh diff --git a/templates/watchtower/_uninstall.sh b/templates/watchtower/uninstall.sh similarity index 100% rename from templates/watchtower/_uninstall.sh rename to templates/watchtower/uninstall.sh