From 32267b969ef1d4de36cc1df1c194960b9b6a0efa Mon Sep 17 00:00:00 2001 From: Anuj Gupta Date: Sat, 6 Feb 2021 05:29:12 +0000 Subject: [PATCH] Merge branch '15-disable-redis-tls-flag' into 'ibm-impl' Added config for REDIS TLS See merge request osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-service!10 (cherry picked from commit fb2c21ed29753e8fc96b78b5c06b5d57f107d9ac) 181b51ce Added config for REDIS TLS --- src/cloud/config.ts | 6 ++++++ src/shared/cache.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cloud/config.ts b/src/cloud/config.ts index 5de09003..0d372e37 100644 --- a/src/cloud/config.ts +++ b/src/cloud/config.ts @@ -57,6 +57,9 @@ export abstract class Config implements IConfig { // Unit Test activation flag public static UTEST: string; + // Cache TLS DISABLE flag + public static CACHE_TLS_DISABLE: string; + // Service base configurations public static SERVICE_ENV: string; public static SERVICE_PORT: number; @@ -216,3 +219,6 @@ export class ConfigFactory extends CloudFactory { // Set the Utest flag correctly as sooon as the config class get loaded Config.UTEST = process.env.UTEST; + +// Set the CACHE(REDIS) TLS DISABLE flag correctly. If not SET TLS is assume enabled so that change is non breaking +Config.CACHE_TLS_DISABLE = process.env.CACHE_TLS_DISABLE; diff --git a/src/shared/cache.ts b/src/shared/cache.ts index 7135b1b5..7ad35172 100644 --- a/src/shared/cache.ts +++ b/src/shared/cache.ts @@ -37,12 +37,18 @@ export class Cache { this._redisClient = Config.UTEST ? require('redis-mock').createClient() : - connection.KEY ? + connection.KEY ? Config.CACHE_TLS_DISABLE ? redis.createClient({ host: connection.ADDRESS, port: connection.PORT, auth_pass: connection.KEY, - tls: {servername: connection.ADDRESS}}) : + }) : + redis.createClient({ + host: connection.ADDRESS, + port: connection.PORT, + auth_pass: connection.KEY, + tls: { servername: connection.ADDRESS } + }) : redis.createClient({ host: connection.ADDRESS, port: connection.PORT, -- GitLab