implemented checking for different kinds of deploy file

This commit is contained in:
tomo 2025-02-21 15:51:02 +01:00
parent f275f3c150
commit 06e75de728
No known key found for this signature in database
GPG Key ID: 5FB8BCB7CE54EE44

View File

@ -5,7 +5,8 @@
######## Public functions ##################### ######## Public functions #####################
MULTIDEPLOY_VERSION="1.0" MULTIDEPLOY_VERSION="1.0"
MULTIDEPLOY_FILENAME="multideploy.yaml" MULTIDEPLOY_FILENAME="multideploy.yml"
MULTIDEPLOY_FILENAME2="multideploy.yaml"
# domain keyfile certfile cafile fullchain pfx # domain keyfile certfile cafile fullchain pfx
multideploy_deploy() { multideploy_deploy() {
@ -56,18 +57,30 @@ multideploy_deploy() {
# deploy_filepath # deploy_filepath
_preprocess_deployfile() { _preprocess_deployfile() {
_deploy_file="$1"
# Check if yq is installed # Check if yq is installed
if ! command -v yq >/dev/null 2>&1; then if ! command -v yq >/dev/null 2>&1; then
_err "yq is not installed! Please install yq and try again." _err "yq is not installed! Please install yq and try again."
return 1 return 1
fi fi
_debug3 "yq is installed."
# Check if deploy file exists and create a default template if not # Check if deploy file exists
if [ -f "$_deploy_file" ]; then for file in "$@"; do
_debug3 "Deploy file found." _debug3 "Checking file" "$DOMAIN_PATH/$file"
_check_deployfile "$_deploy_file" "$MULTIDEPLOY_CONFIG" if [ -f "$DOMAIN_PATH/$file" ]; then
_debug3 "File found"
if [ -n "$found_file" ]; then
_err "Multiple deploy files found. Please keep only one deploy file."
return 1
fi
found_file="$file"
else
_debug3 "File not found"
fi
done
if [ -n "$found_file" ]; then
_check_deployfile "$DOMAIN_PATH/$found_file" "$MULTIDEPLOY_CONFIG"
else else
# TODO: Replace URL with wiki link # TODO: Replace URL with wiki link
_err "Deploy file not found. Go to https://CHANGE_URL_TO_WIKI to see how to create one." _err "Deploy file not found. Go to https://CHANGE_URL_TO_WIKI to see how to create one."