Skip to content

Commit

Permalink
chore: add suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
katyaterletskaya committed Mar 4, 2024
1 parent 51956c7 commit 55cc565
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
14 changes: 14 additions & 0 deletions apps/api/src/config/env-validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { bool, cleanEnv, json, makeValidator, port, str, num, url, ValidatorSpec } from 'envalid';
import {
DEFAULT_MESSAGE_GENERIC_RETENTION_DAYS,
DEFAULT_MESSAGE_IN_APP_RETENTION_DAYS,
DEFAULT_NOTIFICATION_RETENTION_DAYS,
} from '@novu/shared';

const str32 = makeValidator((variable) => {
if (!(typeof variable === 'string') || variable.length != 32) {
Expand Down Expand Up @@ -88,6 +93,15 @@ const validators: { [K in keyof any]: ValidatorSpec<any[K]> } = {
default: 'false',
choices: ['false', 'true'],
}),
NOTIFICATION_RETENTION_DAYS: num({
default: DEFAULT_NOTIFICATION_RETENTION_DAYS,
}),
MESSAGE_GENERIC_RETENTION_DAYS: num({
default: DEFAULT_MESSAGE_GENERIC_RETENTION_DAYS,
}),
MESSAGE_IN_APP_RETENTION_DAYS: num({
default: DEFAULT_MESSAGE_IN_APP_RETENTION_DAYS,
}),
};

if (process.env.STORAGE_SERVICE === 'AZURE') {
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/types/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ declare global {
SENTRY_DSN: string;
STRIPE_API_KEY: string;
STRIPE_CONNECT_SECRET: string;
NOTIFICATION_RETENTION_DAYS?: number;
MESSAGE_GENERIC_RETENTION_DAYS?: number;
MESSAGE_IN_APP_RETENTION_DAYS?: number;
}
}
}
11 changes: 8 additions & 3 deletions apps/worker/src/config/env-validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { cleanEnv, json, port, str, num, ValidatorSpec, makeValidator } from 'envalid';
import {
DEFAULT_MESSAGE_GENERIC_RETENTION_DAYS,
DEFAULT_MESSAGE_IN_APP_RETENTION_DAYS,
DEFAULT_NOTIFICATION_RETENTION_DAYS,
} from '@novu/shared';

const str32 = makeValidator((variable) => {
if (!(typeof variable === 'string') || variable.length != 32) {
Expand Down Expand Up @@ -54,13 +59,13 @@ const validators: { [K in keyof any]: ValidatorSpec<any[K]> } = {
default: undefined,
}),
NOTIFICATION_RETENTION_DAYS: num({
default: 30,
default: DEFAULT_NOTIFICATION_RETENTION_DAYS,
}),
MESSAGE_GENERIC_RETENTION_DAYS: num({
default: 30,
default: DEFAULT_MESSAGE_GENERIC_RETENTION_DAYS,
}),
MESSAGE_IN_APP_RETENTION_DAYS: num({
default: 365,
default: DEFAULT_MESSAGE_IN_APP_RETENTION_DAYS,
}),
};

Expand Down

0 comments on commit 55cc565

Please sign in to comment.