Skip to content

Commit

Permalink
chore: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mats16 committed Jun 16, 2023
1 parent bc82a64 commit dac8130
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/amazon-ses-smtp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit dac8130

Please sign in to comment.