diff --git a/src/cloud/config.ts b/src/cloud/config.ts index 5de09003a885524bd702b96cd0412b9ba3f4012d..0d372e37123e461ed32c93f0c85d53343596dd76 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 7135b1b58651d61ee81d2c602f086dd79e53897c..7ad3517230a95ee138e2f9f55484b8d59b2c4bd4 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,