Skip to content

Commit 2fb4a3b

Browse files
committed
Add TLS strings to the redis config.
1 parent b452085 commit 2fb4a3b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

libs/data-api/src/lib/data-api.module.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import { RedisModule } from "@nestjs-modules/ioredis";
99
RedisModule.forRootAsync({
1010
imports: [ConfigModule.forRoot({ isGlobal: true })],
1111
inject: [ConfigService],
12-
useFactory: (configService: ConfigService) => ({
13-
type: "single",
14-
url: `redis://${configService.get("REDIS_HOST")}:${configService.get("REDIS_PORT")}`
15-
})
12+
useFactory: (configService: ConfigService) => {
13+
const protocol = process.env["NODE_ENV"] === "development" ? "redis://" : "rediss://";
14+
return {
15+
type: "single",
16+
url: `${protocol}${configService.get("REDIS_HOST")}:${configService.get("REDIS_PORT")}`
17+
};
18+
}
1619
})
1720
],
1821
providers: [DataApiService],

0 commit comments

Comments
 (0)