Skip to content

Commit

Permalink
corrected and improved the _getdeployconf and _savedeployconf in _DA_…
Browse files Browse the repository at this point in the history
…credentials()
  • Loading branch information
Eddict committed Mar 18, 2024
1 parent 648c6b6 commit fb110c3
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions deploy/directadmin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb110c3

Please sign in to comment.