Skip to content

Commit

Permalink
test: redis config
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislavkopal committed Aug 6, 2023
1 parent 4f72695 commit f01fb29
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ services:
- API_PREFIX=${API_PREFIX}
- AUTH_JWT_SECRET=${AUTH_JWT_SECRET}
- AUTH_JWT_TOKEN_EXPIRES_IN=${AUTH_JWT_TOKEN_EXPIRES_IN}
- REDIS_HOST=redis
- REDIS_PORT=${REDIS_PORT}
- REDIS_PASSWORD=${REDIS_PASSWORD}
depends_on:
- mongodb

Expand Down
3 changes: 3 additions & 0 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ services:
- API_PREFIX=${API_PREFIX}
- AUTH_JWT_SECRET=${AUTH_JWT_SECRET}
- AUTH_JWT_TOKEN_EXPIRES_IN=${AUTH_JWT_TOKEN_EXPIRES_IN}
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
- REDIS_PASSWORD=${REDIS_PASSWORD}
depends_on:
- mongodb
networks:
Expand Down
16 changes: 11 additions & 5 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ import { BullModule } from '@nestjs/bull';
imports: [
BullModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
redis: {
useFactory: async (configService: ConfigService) => {
const redisConfig = {
host: configService.getOrThrow<string>('redis.host'),
port: configService.getOrThrow<number>('redis.port'),
password: configService.getOrThrow<string>('redis.password'),
},
}),
};

console.log('Redis config:', redisConfig);

return {
redis: redisConfig,
};
},
inject: [ConfigService],
}),
LoggerModule.forRootAsync({
Expand All @@ -50,7 +56,7 @@ import { BullModule } from '@nestjs/bull';
pinoHttp: {
level:
configService.getOrThrow<string>('app.nodeEnv') !== 'production'
? 'debug'
? 'info' // TODO update
: 'info',
transport:
configService.getOrThrow<string>('app.nodeEnv') !== 'production'
Expand Down

0 comments on commit f01fb29

Please sign in to comment.