From dac81305d76ceb70bf9453446bda13e6b42db726 Mon Sep 17 00:00:00 2001 From: Kazuki Matsuda Date: Fri, 16 Jun 2023 13:42:16 +0900 Subject: [PATCH] chore: add comments --- src/amazon-ses-smtp/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/amazon-ses-smtp/index.ts b/src/amazon-ses-smtp/index.ts index 427f8b5..c4c8283 100644 --- a/src/amazon-ses-smtp/index.ts +++ b/src/amazon-ses-smtp/index.ts @@ -69,14 +69,21 @@ export class SesSmtp extends Construct { description: 'Amazon WorkMail for Test Domain', organization: { region: region, alias: stackId }, }); + // Add condition + (workMail.node.defaultChild as cdk.CfnStack).cfnOptions.condition = workMailEnabled; /** The mail user on WorkMail */ const workMailUser = workMail.organization.addUser('Supabase', password.getAttString('Password')); - (workMail.node.defaultChild as cdk.CfnStack).cfnOptions.condition = workMailEnabled; this.host = cdk.Fn.conditionIf(workMailEnabled.logicalId, `smtp.mail.${region}.awsapps.com`, `email-smtp.${region}.amazonaws.com`).toString(); this.port = 465; this.email = cdk.Fn.conditionIf(workMailEnabled.logicalId, workMailUser.getAtt('Email'), email).toString(); + + /** + * SMTP username + * + * If WorkMail is enabled, use the WorkMail user's email address. + */ const username = cdk.Fn.conditionIf(workMailEnabled.logicalId, workMailUser.getAtt('Email'), accessKey.ref).toString(); this.secret = new Secret(this, 'Secret', {