Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/middlewares/legacy-auth
1 result
Select Git revision
Show changes
Commits on Source (2)
...@@ -7,7 +7,12 @@ export class RedisHealthIndicator extends HealthIndicator { ...@@ -7,7 +7,12 @@ export class RedisHealthIndicator extends HealthIndicator {
async checkRedisConnection(redisConf: { sentinelHost: string, sentinelPort: number, groupName: string; }): Promise<HealthIndicatorResult> { async checkRedisConnection(redisConf: { sentinelHost: string, sentinelPort: number, groupName: string; }): Promise<HealthIndicatorResult> {
const client = new IORedis({ host: redisConf.sentinelHost, port: redisConf.sentinelPort}); const client = new IORedis({
sentinels: [
{ host: redisConf.sentinelHost, port: redisConf.sentinelPort },
],
name: redisConf.groupName,
});
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
client.on('ready', resolve); client.on('ready', resolve);
...@@ -28,4 +33,4 @@ export class RedisHealthIndicator extends HealthIndicator { ...@@ -28,4 +33,4 @@ export class RedisHealthIndicator extends HealthIndicator {
return this.getStatus('Redis', true); return this.getStatus('Redis', true);
} }
} }
\ No newline at end of file
...@@ -13,7 +13,16 @@ export class Redis { ...@@ -13,7 +13,16 @@ export class Redis {
Logger.log(`Entering function`, `Redis.connect`); Logger.log(`Entering function`, `Redis.connect`);
let cfg:any={ let cfg:any={
host: this.redisConfig.sentinelHost, port: this.redisConfig.sentinelPort , host: this.redisConfig.sentinelHost, port: this.redisConfig.sentinelPort ,
name: this.redisConfig.groupName,
}; };
if(this.redisConfig.sentinel){
cfg={
sentinels: [
{ host: this.redisConfig.sentinelHost, port: this.redisConfig.sentinelPort },
],
name: this.redisConfig.groupName,
};
}
const client = new IORedis(cfg); const client = new IORedis(cfg);
...@@ -94,4 +103,4 @@ export class Redis { ...@@ -94,4 +103,4 @@ export class Redis {
handleError(error, new InternalServerErrorException('Couldn\'t remove key/value in redis.')); handleError(error, new InternalServerErrorException('Couldn\'t remove key/value in redis.'));
} }
} }
} }
\ No newline at end of file