From 9f9dbdbdeeae2d1a6d501b273b96e077de9b778e Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Thu, 18 Apr 2024 08:21:32 +0300 Subject: [PATCH] chore: make cache config follow slack notification config Signed-off-by: Heikki Hellgren --- plugins/notifications-backend-module-email/README.md | 4 +++- plugins/notifications-backend-module-email/config.d.ts | 10 ++++++---- .../src/processor/NotificationsEmailProcessor.ts | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/notifications-backend-module-email/README.md b/plugins/notifications-backend-module-email/README.md index f87ce8c18e..1bdfd59c01 100644 --- a/plugins/notifications-backend-module-email/README.md +++ b/plugins/notifications-backend-module-email/README.md @@ -20,7 +20,9 @@ notifications: sender: 'sender@mycompany.com' replyTo: 'no-reply@mycompany.com' broadcastConfig: - receiver: 'user' + receiver: 'users' + cache: + ttl: 60000 ``` See `config.d.ts` for more options for configuration. diff --git a/plugins/notifications-backend-module-email/config.d.ts b/plugins/notifications-backend-module-email/config.d.ts index 3d85022193..ec92bb8813 100644 --- a/plugins/notifications-backend-module-email/config.d.ts +++ b/plugins/notifications-backend-module-email/config.d.ts @@ -105,10 +105,12 @@ export interface Config { */ receiverEmails?: string[]; }; - /** - * Email cache TTL, defaults to 1 hour - */ - cacheTtl?: number; + cache?: { + /** + * Email cache TTL, defaults to 1 hour + */ + ttl?: number; + }; }; }; }; diff --git a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts index 4a190a8bb7..f9e9ac7bd3 100644 --- a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts +++ b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts @@ -58,7 +58,7 @@ export class NotificationsEmailProcessor implements NotificationProcessor { config.getOptionalString('notifications.email.format') ?? 'html'; this.replyTo = config.getOptionalString('notifications.email.replyTo'); this.cacheTtl = - config.getOptionalNumber('notifications.email.cacheTtl') ?? 3_600_000; + config.getOptionalNumber('notifications.email.cache.ttl') ?? 3_600_000; } private async getTransporter() {