From fb110c38cdc09c3f960e6eeeb2fe2cce1aca0261 Mon Sep 17 00:00:00 2001 From: Eddict Date: Mon, 18 Mar 2024 22:20:08 +0100 Subject: [PATCH] corrected and improved the _getdeployconf and _savedeployconf in _DA_credentials() --- deploy/directadmin.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/deploy/directadmin.sh b/deploy/directadmin.sh index b16d5ff3..e4374c40 100644 --- a/deploy/directadmin.sh +++ b/deploy/directadmin.sh @@ -42,19 +42,26 @@ directadmin_deploy() { # Usage: _DA_credentials # It will check if the needed settings are available _DA_credentials() { - DEPLOY_DA_Api="${DEPLOY_DA_Api:-$(_getdeployconf DEPLOY_DA_Api)}" - DEPLOY_DA_Api_Insecure="${DEPLOY_DA_Api_Insecure:-$(_getdeployconf DEPLOY_DA_Api_Insecure)}" - if [ -z "${DEPLOY_DA_Api}" ] || [ -z "${DEPLOY_DA_Api_Insecure}" ]; then - DEPLOY_DA_Api="" - DEPLOY_DA_Api_Insecure="" - _err "You haven't specified the DirectAdmin Login data, URL and whether you want check the DirectAdmin SSL cert. Please try again." + _getdeployconf DEPLOY_DA_Api + if [ -z "$DEPLOY_DA_Api" ]; then + _err "You haven't specified the DirectAdmin Login data/URL. Please set the env variable DEPLOY_DA_Api" return 1 else - _saveaccountconf_mutable DEPLOY_DA_Api "${DEPLOY_DA_Api}" - _saveaccountconf_mutable DEPLOY_DA_Api_Insecure "${DEPLOY_DA_Api_Insecure}" - # Set whether curl should use secure or insecure mode - export HTTPS_INSECURE="${DEPLOY_DA_Api_Insecure}" + _savedeployconf DEPLOY_DA_Api "$DEPLOY_DA_Api" fi + _debug2 DEPLOY_DA_Api "$DEPLOY_DA_Api" + + _getdeployconf DEPLOY_DA_Api_Insecure + if [ -z "$DEPLOY_DA_Api_Insecure" ]; then + _debug "Using DEPLOY_DA_Api_Insecure=0 so ssl cert is checked for validity, please set to 1 to have it just accepted." + DEPLOY_DA_Api_Insecure=0 + else + _savedeployconf DEPLOY_DA_Api_Insecure "$DEPLOY_DA_Api_Insecure" + fi + _debug2 DEPLOY_DA_Api_Insecure "$DEPLOY_DA_Api_Insecure" + + # Set whether curl/wget should use secure or insecure mode + export HTTPS_INSECURE="${DEPLOY_DA_Api_Insecure}" } # Usage: _da_get_api CMD_API_* data example.com