fix _MAILGUN_BASE for US region

This commit is contained in:
Honza Hommer 2019-05-13 17:59:50 +02:00
parent 9ab318cafc
commit 04b811e9ac
No known key found for this signature in database
GPG Key ID: 5EBDE8E7E1A00ACA

View File

@ -28,14 +28,23 @@ mailgun_send() {
_saveaccountconf_mutable MAILGUN_API_KEY "$MAILGUN_API_KEY" _saveaccountconf_mutable MAILGUN_API_KEY "$MAILGUN_API_KEY"
MAILGUN_REGION="${MAILGUN_REGION:-$(_readaccountconf_mutable MAILGUN_REGION)}" MAILGUN_REGION="${MAILGUN_REGION:-$(_readaccountconf_mutable MAILGUN_REGION)}"
if [ -z "$MAILGUN_REGION" ]; then case "$MAILGUN_REGION" in
MAILGUN_REGION="" [Uu][Ss] | "")
_debug "The MAILGUN_REGION is not set, so use the default us region." if [ -z "$MAILGUN_REGION" ]; then
_MAILGUN_BASE="https://api.mailgun.net/v3" _debug "The MAILGUN_REGION is not set, so use the default us region."
else fi
_saveaccountconf_mutable MAILGUN_REGION "$MAILGUN_REGION" MAILGUN_REGION=""
_MAILGUN_BASE="https://api.eu.mailgun.net/v3" _MAILGUN_BASE="https://api.mailgun.net/v3"
fi ;;
[Ee][Uu])
_saveaccountconf_mutable MAILGUN_REGION "$MAILGUN_REGION"
_MAILGUN_BASE="https://api.$MAILGUN_REGION.mailgun.net/v3"
;;
*)
_err "$MAILGUN_REGION is not a valid region."
return 1
;;
esac
MAILGUN_TO="${MAILGUN_TO:-$(_readaccountconf_mutable MAILGUN_TO)}" MAILGUN_TO="${MAILGUN_TO:-$(_readaccountconf_mutable MAILGUN_TO)}"
if [ -z "$MAILGUN_TO" ]; then if [ -z "$MAILGUN_TO" ]; then