@ti-engine/core 1.12.3 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/utils/config.js CHANGED
@@ -35,12 +35,15 @@ const settingsEnum = tools.enum( {
35
35
  LOCALIZATION_LABELS_PATH: [ "localization.labelsPath", "labelsPath", "" ],
36
36
  LOCALIZATION_LANGUAGE: [ "localization.language", "language", "" ],
37
37
  MEMORY_CACHE_AUTH_KEY: [ "memoryCache.authKey", "authKey", "" ],
38
+ MEMORY_CACHE_PROVIDER: [ "memoryCache.provider", "provider", "" ],
38
39
  MEMORY_CACHE_REDIS_DB: [ "memoryCache.redisDB", "redisDB", "" ],
39
40
  MEMORY_CACHE_REDIS_HOST: [ "memoryCache.redisHost", "redisHost", "" ],
40
41
  MEMORY_CACHE_REDIS_PORT: [ "memoryCache.redisPort", "redisPort", "" ],
42
+ MEMORY_CACHE_REQUIRED_CAPABILITIES: [ "memoryCache.requiredCapabilities", "requiredCapabilities", "" ],
41
43
  MEMORY_CACHE_RETRY_MAX_ATTEMPTS: [ "memoryCache.retryMaxAttempts", "retryMaxAttempts", "" ],
42
44
  MEMORY_CACHE_RETRY_MAX_INTERVAL: [ "memoryCache.retryMaxInterval", "retryMaxInterval", "" ],
43
45
  MEMORY_CACHE_USER: [ "memoryCache.user", "user", "" ],
46
+ MESSAGE_EXCHANGE_ENABLED: [ "messageExchange.enabled", "enabled", "" ],
44
47
  MESSAGE_EXCHANGE_QUEUE_PREFIX: [ "messageExchange.messageQueuePrefix", "messageQueuePrefix", "" ],
45
48
  MESSAGE_EXCHANGE_MESSAGE_STORE: [ "messageExchange.messageStore", "messageStore", "" ],
46
49
  MESSAGE_EXCHANGE_SECURITY_HASH_ENABLED: [ "messageExchange.securityHashEnabled", "securityHashEnabled", "" ],
@@ -50,6 +53,7 @@ const settingsEnum = tools.enum( {
50
53
  MESSAGE_EXCHANGE_TRACE_REPOSITORY: [ "messageExchange.traceRepository", "traceRepository", "" ],
51
54
  SERVICE_EXECUTION_TIMEOUT: [ "serviceConfig.executionTimeout", "executionTimeout", "" ],
52
55
  SERVICE_HEALTH_CHECK_ADDRESS: [ "serviceConfig.healthCheckAddress", "healthCheckAddress", "" ],
56
+ SERVICE_HEALTH_CHECK_ENABLED: [ "serviceConfig.healthCheckEnabled", "healthCheckEnabled", "" ],
53
57
  SERVICE_HEALTH_CHECK_INTERVAL: [ "serviceConfig.healthCheckInterval", "healthCheckInterval", "" ],
54
58
  SERVICE_HEALTH_CHECK_TIMEOUT: [ "serviceConfig.healthCheckTimeout", "healthCheckTimeout", "" ],
55
59
  SERVICE_REGISTRY_ADDRESS: [ "serviceConfig.serviceRegistryAddress", "serviceRegistryAddress", "" ],
@@ -75,14 +79,22 @@ if ( settings.localization ) {
75
79
  }
76
80
  if ( settings.memoryCache ) {
77
81
  settings.memoryCache.authKey = ( process.env.TI_MEMORY_CACHE_AUTH_KEY !== undefined ) ? process.env.TI_MEMORY_CACHE_AUTH_KEY : settings.memoryCache.authKey;
82
+ settings.memoryCache.provider = ( process.env.TI_MEMORY_CACHE_PROVIDER !== undefined ) ? process.env.TI_MEMORY_CACHE_PROVIDER : settings.memoryCache.provider;
78
83
  settings.memoryCache.redisDB = ( process.env.TI_MEMORY_CACHE_REDIS_DB !== undefined ) ? Number( process.env.TI_MEMORY_CACHE_REDIS_DB ) : settings.memoryCache.redisDB;
79
84
  settings.memoryCache.redisHost = ( process.env.TI_MEMORY_CACHE_REDIS_HOST !== undefined ) ? process.env.TI_MEMORY_CACHE_REDIS_HOST : settings.memoryCache.redisHost;
80
85
  settings.memoryCache.redisPort = ( process.env.TI_MEMORY_CACHE_REDIS_PORT !== undefined ) ? Number( process.env.TI_MEMORY_CACHE_REDIS_PORT ) : settings.memoryCache.redisPort;
86
+ // Comma-separated in the environment because that is all an env var can carry; an array everywhere else. An
87
+ // empty value means "require nothing", which is what keeps a deployment that never declared capabilities
88
+ // behaving exactly as it did before they existed.
89
+ settings.memoryCache.requiredCapabilities = ( process.env.TI_MEMORY_CACHE_REQUIRED_CAPABILITIES !== undefined )
90
+ ? String( process.env.TI_MEMORY_CACHE_REQUIRED_CAPABILITIES ).split( "," ).map( ( capability ) => capability.trim() ).filter( ( capability ) => capability.length > 0 )
91
+ : settings.memoryCache.requiredCapabilities;
81
92
  settings.memoryCache.retryMaxAttempts = ( process.env.TI_MEMORY_CACHE_RETRY_MAX_ATTEMPTS !== undefined ) ? Number( process.env.TI_MEMORY_CACHE_RETRY_MAX_ATTEMPTS ) : settings.memoryCache.retryMaxAttempts;
82
93
  settings.memoryCache.retryMaxInterval = ( process.env.TI_MEMORY_CACHE_RETRY_MAX_INTERVAL !== undefined ) ? Number( process.env.TI_MEMORY_CACHE_RETRY_MAX_INTERVAL ) : settings.memoryCache.retryMaxInterval;
83
94
  settings.memoryCache.user = ( process.env.TI_MEMORY_CACHE_USER !== undefined ) ? process.env.TI_MEMORY_CACHE_USER : settings.memoryCache.user;
84
95
  }
85
96
  if ( settings.messageExchange ) {
97
+ settings.messageExchange.enabled = ( process.env.TI_MESSAGE_EXCHANGE_ENABLED !== undefined ) ? tools.toBool( process.env.TI_MESSAGE_EXCHANGE_ENABLED ) : settings.messageExchange.enabled;
86
98
  settings.messageExchange.securityHashEnabled = ( process.env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_ENABLED !== undefined ) ? tools.toBool( process.env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_ENABLED ) : settings.messageExchange.securityHashEnabled;
87
99
  settings.messageExchange.securityHashKey = ( process.env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_KEY !== undefined ) ? process.env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_KEY : settings.messageExchange.securityHashKey;
88
100
  settings.messageExchange.traceLogEnabled = ( process.env.TI_MESSAGE_EXCHANGE_TRACE_LOG_ENABLED !== undefined ) ? tools.toBool( process.env.TI_MESSAGE_EXCHANGE_TRACE_LOG_ENABLED ) : settings.messageExchange.traceLogEnabled;