feat: add redis authentication
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { RedisService } from './providers/redis.service';
|
import { RedisService } from './providers/redis.service';
|
||||||
import { REDIS } from './constants/redis.constants';
|
import { REDIS } from './constants/redis.constants';
|
||||||
@@ -15,6 +13,7 @@ import Redis from 'ioredis';
|
|||||||
return new Redis({
|
return new Redis({
|
||||||
host: configService.get<string>('redis.host'),
|
host: configService.get<string>('redis.host'),
|
||||||
port: configService.get<number>('redis.port'),
|
port: configService.get<number>('redis.port'),
|
||||||
|
password: configService.get<string>('redis.password'),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export default Joi.object({
|
|||||||
JWT_AUDIENCE: Joi.string().required(),
|
JWT_AUDIENCE: Joi.string().required(),
|
||||||
REDIS_HOST: Joi.string().required(),
|
REDIS_HOST: Joi.string().required(),
|
||||||
REDIS_PORT: Joi.number().port().default(6379),
|
REDIS_PORT: Joi.number().port().default(6379),
|
||||||
|
REDIS_PASSWORD: Joi.string().required(),
|
||||||
CORS_ORIGINS: Joi.string().required(),
|
CORS_ORIGINS: Joi.string().required(),
|
||||||
CORS_SUBDOMAIN: Joi.string().required(),
|
CORS_SUBDOMAIN: Joi.string().required(),
|
||||||
SWAGGER_SERVERS: Joi.string().required(),
|
SWAGGER_SERVERS: Joi.string().required(),
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ import { registerAs } from '@nestjs/config';
|
|||||||
export default registerAs('redis', () => ({
|
export default registerAs('redis', () => ({
|
||||||
host: process.env.REDIS_HOST || 'localhost',
|
host: process.env.REDIS_HOST || 'localhost',
|
||||||
port: parseInt(process.env.REDIS_PORT || '6379', 10),
|
port: parseInt(process.env.REDIS_PORT || '6379', 10),
|
||||||
|
password: process.env.REDIS_PASSWORD,
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user