diff --git a/.env.dev b/.env.dev index 07dcbbd..1dd2b14 100644 --- a/.env.dev +++ b/.env.dev @@ -10,3 +10,6 @@ MAIL_PASSWORD=QXzdjzWURMU3x1USFB MAIL_FROM="Therese Koch " DATABASE_URL="postgresql://project:project@localhost:5432/project?schema=public" + +REDIS_HOST=localhost +REDIS_PORT=6379 diff --git a/.env.dev.example b/.env.dev.example index 1fd8b3a..a6df51f 100644 --- a/.env.dev.example +++ b/.env.dev.example @@ -12,3 +12,6 @@ MAIL_PORT=587 MAIL_USER=camylle.rau@ethereal.email MAIL_PASSWORD=7rXNZtDR4Yq1seGBxg MAIL_FROM="Camylle Rau " + +REDIS_HOST=localhost +REDIS_PORT=6379 diff --git a/prisma/seed.js b/prisma/seed.js index 568f48e..33b6690 100644 --- a/prisma/seed.js +++ b/prisma/seed.js @@ -21,7 +21,7 @@ async function main() { if (env.NODE_ENV === 'development') { await development() - } else if (env.NODE_ENV === 'production') { + } else if (env.NODE_ENV === 'production' || env.NODE_ENV === 'preview') { // comment this line when first missionary field is open and real data is going to be sent // don't forget to exclude fictitious data await production() diff --git a/src/app.module.ts b/src/app.module.ts index ebcfda4..dbd6743 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -46,11 +46,11 @@ import { QueueModule } from './queue/queue.module' limit: config.get('throttle.limit'), }], }), - BullModule.forRoot({ - redis: { - host: 'localhost', - port: 6379, - }, + BullModule.forRootAsync({ + inject: [ConfigService], + useFactory: (config: ConfigService) => ({ + redis: config.get('redis') + }) }), QueueModule, diff --git a/src/config/configuration.ts b/src/config/configuration.ts index de4be6f..1624d9d 100644 --- a/src/config/configuration.ts +++ b/src/config/configuration.ts @@ -78,4 +78,9 @@ export default () => ({ log: { clearBeyondMonths: 3, }, + + redis: { + host: process.env.REDIS_HOST, + port: process.env.REDIS_PORT + } })