From 3e492e6310496e26c85ca1d42223b3e59c89322c Mon Sep 17 00:00:00 2001 From: Jasmine Schladen Date: Wed, 28 Oct 2020 17:09:54 -0700 Subject: [PATCH] Add ability to override SES region --- docs/administration.rst | 9 +++++++++ lemur/plugins/lemur_email/plugin.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/administration.rst b/docs/administration.rst index a1eba56e..7e94a4db 100644 --- a/docs/administration.rst +++ b/docs/administration.rst @@ -295,6 +295,15 @@ Lemur supports sending certificate expiration notifications through SES and SMTP See: `Using sending authorization with Amazon SES `_ +.. 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: diff --git a/lemur/plugins/lemur_email/plugin.py b/lemur/plugins/lemur_email/plugin.py index 39e76932..a9e35d16 100644 --- a/lemur/plugins/lemur_email/plugin.py +++ b/lemur/plugins/lemur_email/plugin.py @@ -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"),