Add ability to override SES region

This commit is contained in:
Jasmine Schladen 2020-10-28 17:09:54 -07:00
parent 5e696f36bf
commit 3e492e6310
2 changed files with 13 additions and 1 deletions

View File

@ -295,6 +295,15 @@ Lemur supports sending certificate expiration notifications through SES and SMTP
See: `Using sending authorization with Amazon SES <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html>`_
.. data:: LEMUR_SES_REGION
:noindex:
Specifies a region for sending emails via SES.
.. note::
This parameter defaults to us-east-1 and is only required if you wish to use a different region.
.. data:: LEMUR_EMAIL
:noindex:

View File

@ -61,7 +61,10 @@ def send_via_ses(subject, body, targets):
:param targets:
:return:
"""
client = boto3.client("ses", region_name="us-east-1")
ses_region = current_app.config.get("LEMUR_SES_REGION")
if not ses_region:
ses_region = "us-east-1"
client = boto3.client("ses", region_name=ses_region)
source_arn = current_app.config.get("LEMUR_SES_SOURCE_ARN")
args = {
"Source": current_app.config.get("LEMUR_EMAIL"),