Skip to content

Commit

Permalink
feat(application-generic): add SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME …
Browse files Browse the repository at this point in the history
…env variable (#7105)

Co-authored-by: Dima Grossman <dima@grossman.io>
  • Loading branch information
jainpawan21 and scopsy authored Nov 27, 2024
1 parent ab76a48 commit 77da246
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apps/api/src/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ TUNNEL_BASE_ADDRESS=
PLAIN_SUPPORT_KEY='PLAIN_SUPPORT_KEY'
PLAIN_IDENTITY_VERIFICATION_SECRET_KEY='PLAIN_IDENTITY_VERIFICATION_SECRET_KEY'
NOVU_INTERNAL_SECRET_KEY=
# expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d"
SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME='15 days'
1 change: 1 addition & 0 deletions apps/api/src/config/env.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const envValidators = {
LEGACY_STAGING_DASHBOARD_URL: url({ default: undefined }),
API_ROOT_URL: url(),
NOVU_INVITE_TEAM_MEMBER_NUDGE_TRIGGER_IDENTIFIER: str({ default: undefined }),
SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME: str({ default: '15 days' }),

// Novu Cloud third party services
...(processEnv.IS_SELF_HOSTED !== 'true' &&
Expand Down
2 changes: 2 additions & 0 deletions apps/worker/src/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ BROADCAST_QUEUE_CHUNK_SIZE=100
MULTICAST_QUEUE_CHUNK_SIZE=100

API_ROOT_URL=http://localhost:3000
# expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d"
SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME='15 days'
2 changes: 1 addition & 1 deletion apps/worker/src/config/env.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const envValidators = {
STRIPE_API_KEY: str({ default: undefined }),
NOTIFICATION_RETENTION_DAYS: num({ default: DEFAULT_NOTIFICATION_RETENTION_DAYS }),
API_ROOT_URL: url(),

SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME: str({ default: '15 days' }),
// Feature Flags
...Object.keys(FeatureFlagsKeysEnum).reduce(
(acc, key) => {
Expand Down
2 changes: 2 additions & 0 deletions docker/community/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
# used as a secret to verify the JWT token signature
JWT_SECRET=your-secret
# expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d"
SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME="15 days"
# used to encrypt/decrypt the provider credentials
STORE_ENCRYPTION_KEY=<ENCRYPTION_KEY_MUST_BE_32_LONG>

Expand Down
2 changes: 2 additions & 0 deletions docker/community/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ services:
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
JWT_SECRET: ${JWT_SECRET}
STORE_ENCRYPTION_KEY: ${STORE_ENCRYPTION_KEY}
SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME: ${SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME}
SENTRY_DSN: ${SENTRY_DSN}
NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
Expand Down Expand Up @@ -118,6 +119,7 @@ services:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
STORE_ENCRYPTION_KEY: ${STORE_ENCRYPTION_KEY}
SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME: ${SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME}
SENTRY_DSN: ${SENTRY_DSN}
NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ export class CommunityAuthService implements IAuthService {
subscriberId: subscriber.subscriberId,
},
{
expiresIn: '15 day',
expiresIn:
process.env.SUBSCRIBER_WIDGET_JWT_EXPIRATION_TIME || '15 days',
issuer: 'novu_api',
audience: 'widget_user',
},
Expand Down

0 comments on commit 77da246

Please sign in to comment.