fix: Update email processor ses options to match v2
Signed-off-by: Colt McKissick <colt.mckissick.ycbp@statefarm.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-notifications-backend-module-email': minor
|
||||
---
|
||||
|
||||
Changes ses configuration keys to match new configuration options in SES SDK V2
|
||||
+1
-5
@@ -136,14 +136,10 @@ export interface Config {
|
||||
* Optional SES config for mail options. Allows for delegated sender
|
||||
*/
|
||||
sesConfig?: {
|
||||
/**
|
||||
* ARN of the identity to use as the source of the email
|
||||
*/
|
||||
sourceArn?: string;
|
||||
/**
|
||||
* ARN of the identity to use for the "From"/sender address of the email
|
||||
*/
|
||||
fromArn?: string;
|
||||
fromEmailAddressIdentityArn?: string;
|
||||
/**
|
||||
* Name of the configuration set to use when sending email via ses
|
||||
*/
|
||||
|
||||
+3
-5
@@ -458,9 +458,7 @@ describe('NotificationsEmailProcessor', () => {
|
||||
sender: 'backstage@backstage.io',
|
||||
replyTo: 'no-reply@backstage.io',
|
||||
sesConfig: {
|
||||
sourceArn:
|
||||
'arn:aws:ses:us-west-2:123456789012:identity/example.com',
|
||||
fromArn:
|
||||
fromEmailAddressIdentityArn:
|
||||
'arn:aws:ses:us-west-2:123456789012:identity/example.com',
|
||||
},
|
||||
},
|
||||
@@ -497,8 +495,8 @@ describe('NotificationsEmailProcessor', () => {
|
||||
text: 'https://example.org/notifications',
|
||||
to: 'mock@backstage.io',
|
||||
ses: {
|
||||
SourceArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com',
|
||||
FromArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com',
|
||||
FromEmailAddressIdentityArn:
|
||||
'arn:aws:ses:us-west-2:123456789012:identity/example.com',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
+10
-6
@@ -45,6 +45,7 @@ import { DefaultAwsCredentialsManager } from '@backstage/integration-aws-node';
|
||||
import { NotificationTemplateRenderer } from '../extensions';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
import pThrottle from 'p-throttle';
|
||||
import { SendEmailCommandInput } from '@aws-sdk/client-sesv2';
|
||||
|
||||
export class NotificationsEmailProcessor implements NotificationProcessor {
|
||||
private transporter: any;
|
||||
@@ -307,19 +308,22 @@ export class NotificationsEmailProcessor implements NotificationProcessor {
|
||||
return contentParts.join('\n\n');
|
||||
}
|
||||
|
||||
private async getSesOptions() {
|
||||
private async getSesOptions(): Promise<
|
||||
Partial<SendEmailCommandInput> | undefined
|
||||
> {
|
||||
if (!this.sesConfig) {
|
||||
return undefined;
|
||||
}
|
||||
const ses: Record<string, string> = {};
|
||||
const sourceArn = this.sesConfig.getOptionalString('sourceArn');
|
||||
const fromArn = this.sesConfig.getOptionalString('fromArn');
|
||||
const ses: Partial<SendEmailCommandInput> = {};
|
||||
const fromEmailAddressIdentityArn = this.sesConfig.getOptionalString(
|
||||
'fromEmailAddressIdentityArn',
|
||||
);
|
||||
const configurationSetName = this.sesConfig.getOptionalString(
|
||||
'configurationSetName',
|
||||
);
|
||||
|
||||
if (sourceArn) ses.SourceArn = sourceArn;
|
||||
if (fromArn) ses.FromArn = fromArn;
|
||||
if (fromEmailAddressIdentityArn)
|
||||
ses.FromEmailAddressIdentityArn = fromEmailAddressIdentityArn;
|
||||
if (configurationSetName) ses.ConfigurationSetName = configurationSetName;
|
||||
|
||||
return Object.keys(ses).length > 0 ? ses : undefined;
|
||||
|
||||
Reference in New Issue
Block a user