From 767680a137faf5d0782c5e571a9fee29a891cc3b Mon Sep 17 00:00:00 2001 From: Himanshu Garg Date: Thu, 28 Nov 2024 19:04:17 +0530 Subject: [PATCH] feat(env): Add SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME to environment configurations --- apps/api/src/.example.env | 1 + apps/worker/src/.example.env | 1 + docker/.env.example | 1 + docker/local/deployment/docker-compose.yml | 2 ++ .../application-generic/src/services/auth/auth.service.ts | 5 +++-- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/api/src/.example.env b/apps/api/src/.example.env index 347bc9201f4..ffd6f81141f 100644 --- a/apps/api/src/.example.env +++ b/apps/api/src/.example.env @@ -78,3 +78,4 @@ API_RATE_LIMIT_MAXIMUM_FREE_GLOBAL= API_RATE_LIMIT_MAXIMUM_UNLIMITED_TRIGGER= API_RATE_LIMIT_MAXIMUM_UNLIMITED_CONFIGURATION= API_RATE_LIMIT_MAXIMUM_UNLIMITED_GLOBAL= +SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME='15 days' diff --git a/apps/worker/src/.example.env b/apps/worker/src/.example.env index aa1eca2d400..a8b027900de 100644 --- a/apps/worker/src/.example.env +++ b/apps/worker/src/.example.env @@ -75,3 +75,4 @@ LAUNCH_DARKLY_SDK_KEY= BROADCAST_QUEUE_CHUNK_SIZE=100 MULTICAST_QUEUE_CHUNK_SIZE=100 +SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME='15 days' diff --git a/docker/.env.example b/docker/.env.example index 1be4129b2d9..b939f0d3cd9 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -60,3 +60,4 @@ SENTRY_DSN= # change these values NEW_RELIC_APP_NAME= NEW_RELIC_LICENSE_KEY= +SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME="15 days" diff --git a/docker/local/deployment/docker-compose.yml b/docker/local/deployment/docker-compose.yml index 09e4f1a42ba..aef4c096075 100644 --- a/docker/local/deployment/docker-compose.yml +++ b/docker/local/deployment/docker-compose.yml @@ -63,6 +63,7 @@ services: NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME} NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY} API_CONTEXT_PATH: ${API_CONTEXT_PATH} + SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME: ${SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME} ports: - '3000:3000' worker: @@ -98,6 +99,7 @@ services: NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY} BROADCAST_QUEUE_CHUNK_SIZE: ${BROADCAST_QUEUE_CHUNK_SIZE} MULTICAST_QUEUE_CHUNK_SIZE: ${MULTICAST_QUEUE_CHUNK_SIZE} + SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME: ${SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME} ws: image: 'ghcr.io/novuhq/novu/ws:0.24.0' depends_on: diff --git a/packages/application-generic/src/services/auth/auth.service.ts b/packages/application-generic/src/services/auth/auth.service.ts index 7c00311deea..38135d65f90 100644 --- a/packages/application-generic/src/services/auth/auth.service.ts +++ b/packages/application-generic/src/services/auth/auth.service.ts @@ -227,10 +227,11 @@ export class AuthService { subscriberId: subscriber.subscriberId, }, { - expiresIn: '15 day', + expiresIn: + process.env.SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME || '15 days', issuer: 'novu_api', audience: 'widget_user', - } + }, ); }