From 9a524250c1da40286d11b68eb50ed9e35857757e Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 11 Dec 2023 07:21:02 -0500 Subject: [PATCH] Fix for detecting whether or not in HA mode. Effected detecting ZSS cookie and use of caching service Signed-off-by: 1000TurquoisePogs --- CHANGELOG.md | 3 +++ lib/util.js | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a52b7e6..7aac5094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to the Zlux Server Framework package will be documented in this file.. This repo is part of the app-server Zowe Component, and the change logs here may appear on Zowe.org in that section. + +## 2.14.0 +- Bugfix: App-server would not correctly detect when it was running in a high-availability configuration environment. ## 2.13.0 - Added support for using zowe.network and components.app-server.zowe.network to set listener IP and TLS properties including max and min version, ciphers, and ECDH curves. (#511) diff --git a/lib/util.js b/lib/util.js index e8c66ad1..6360a04e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -490,9 +490,11 @@ module.exports.getCookieName = (cookieIdentifier) => { return 'connect.sid.' + cookieIdentifier; } + +const HA_INSTANCE_COUNT=Object.keys(process.env).filter(key=>!key.match(/ZWE_haInstances_.*_components_.*hostname.*/)).filter(key=>key.match(/ZWE_haInstances_.*hostname/)).length; const isHaMode = module.exports.isHaMode = function () { - const haInstanceCount = +process.env['ZWE_HA_INSTANCES_COUNT']; - return (!isNaN(haInstanceCount) && haInstanceCount > 1); + let isHaMode = (!isNaN(HA_INSTANCE_COUNT) && HA_INSTANCE_COUNT > 1); + return isHaMode; } //TODO, ATTLS