Skip to content

Commit dc39b39

Browse files
moving hardcoded default vals to constants
1 parent e40d801 commit dc39b39

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/authentication/core/MerchantConfig.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -690,15 +690,15 @@ MerchantConfig.prototype.defaultPropValues = function defaultPropValues() {
690690
}
691691

692692
// Validate maxIdleSockets is non-negative and not less than default
693-
if (this.maxIdleSockets !== null && this.maxIdleSockets !== undefined && (this.maxIdleSockets <= 0 || this.maxIdleSockets < 100)) {
694-
this.maxIdleSockets = 100;
695-
logger.warn("maxIdleSockets cannot be non-negative or less than default. Setting to default value 100.");
693+
if (this.maxIdleSockets !== null && this.maxIdleSockets !== undefined && (this.maxIdleSockets <= 0 || this.maxIdleSockets < Constants.DEFAULT_MAX_IDLE_SOCKETS)) {
694+
this.maxIdleSockets = Constants.DEFAULT_MAX_IDLE_SOCKETS;
695+
logger.warn("maxIdleSockets cannot be non-negative or less than default. Setting to default value " + Constants.DEFAULT_MAX_IDLE_SOCKETS + ".");
696696
}
697697

698698
// Validate userDefinedTimeout is non-negative and not less than default
699-
if (this.userDefinedTimeout !== null && this.userDefinedTimeout !== undefined && (this.userDefinedTimeout <= 0 || this.userDefinedTimeout < 4000)) {
700-
this.userDefinedTimeout = 4000;
701-
logger.warn("userDefinedTimeout cannot be non-negative or less than default (value should be in milliseconds). Setting to default value 4000.");
699+
if (this.userDefinedTimeout !== null && this.userDefinedTimeout !== undefined && (this.userDefinedTimeout <= 0 || this.userDefinedTimeout < Constants.DEFAULT_USER_DEFINED_TIMEOUT)) {
700+
this.userDefinedTimeout = Constants.DEFAULT_USER_DEFINED_TIMEOUT;
701+
logger.warn("userDefinedTimeout cannot be non-negative or less than default (value should be in milliseconds). Setting to default value " + Constants.DEFAULT_USER_DEFINED_TIMEOUT + ".");
702702
}
703703

704704
//useMLEGlobally check for auth Type

src/authentication/util/Constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ module.exports = {
9797
DEFAULT_LOG_FILENAME : "cybs",
9898
DEFAULT_MAX_LOG_FILES : "10d",
9999
DEFAULT_LOGGING_LEVEL : "error",
100+
DEFAULT_MAX_IDLE_SOCKETS : 100,
101+
DEFAULT_USER_DEFINED_TIMEOUT : 4000, // Value in milliseconds
100102

101103
STATUS200 : "Transaction Successful",
102104
STATUS400 : "Bad Request",
@@ -107,4 +109,4 @@ module.exports = {
107109
STATUS502 : "Bad Gateway",
108110
STATUS503 : "Service Unavailable",
109111
STATUS504 : "Gateway Timeout"
110-
};
112+
};

0 commit comments

Comments
 (0)