@mimik/configuration 5.0.6 → 5.0.7

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.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/index.js +11 -1
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -199,9 +199,12 @@ When `redis` is used the following environement variables are used for the confi
199
199
 
200
200
  | Env variable name | Description | Default | Comments |
201
201
  | ----------------- | ----------- | ------- | -------- |
202
- | CACHE_IP | domain of the redis server to use with port | localhost:6379 |
202
+ | CACHE_IP | domain of the redis server to use with port, a comma seperated list if using cluster | localhost:6379 |
203
203
  | CACHE_USER | redis user if the redis service is auth protected | null |
204
204
  | CACHE_PASSWORD | redis password for the user if the redis service is auth protected | null |
205
+ | CACHE_CLUSTER_SET | set on, when using redis in a cluster. | off |
206
+ | CACHE_CLUSTER_USE_REPLICAS | When set on, distribute load by executing readonly commands (such as GET) across all cluster nodes. When false, only use master nodes | off |
207
+ | CACHE_CLUSTER_MINIMIZE_CONNECTION | When set on, .connect() will only discover the cluster topology, without actually connecting to all the nodes. Useful for short-term or Pub/Sub-only connections. | off |
205
208
  | CACHE_CONNECTION_TIMEOUT | time the server will wait at start to connect to the cache | 30 | in seconds
206
209
  | CACHE_VALIDATION_CHECK | the delay before checking for connection | 1000 | in ms
207
210
  | CACHE_RECONNECTION_OFFSET | offset for the time to reconnect to the database before error is generated | 5 | in seconds
package/index.js CHANGED
@@ -111,6 +111,12 @@ const setupRedis = () => {
111
111
  if (username && password) url += `${username}:${password}@`;
112
112
  url += domain;
113
113
 
114
+ const clusterConfig = {
115
+ set: process.env.CACHE_CLUSTER_SET || SET_OFF,
116
+ useReplicas: process.env.CACHE_CLUSTER_USE_REPLICAS || SET_OFF,
117
+ minimizeConnections: process.env.CACHE_CLUSTER_MINIMIZE_CONNECTION || SET_OFF,
118
+ };
119
+
114
120
  return {
115
121
  domain,
116
122
  username,
@@ -119,6 +125,7 @@ const setupRedis = () => {
119
125
  validationCheck: parseInt(process.env.CACHE_VALIDATION_CHECK, 10) || DEFAULT_CACHE_VALIDATION_CHECK,
120
126
  reconnectOffset: parseInt(process.env.CACHE_RECONNECTION_OFFSET, 10) || DEFAULT_CACHE_RECONNECTION_OFFSET,
121
127
  url,
128
+ cluster: clusterConfig,
122
129
  options: {
123
130
  socket: {
124
131
  keepAlive: process.env.REDIS_SOCKET_KEEPALIVE || DEFAULT_REDIS_SOCKET_KEEPALIVE,
@@ -646,9 +653,12 @@ configuration.locationProvider = setupLocationProvider();
646
653
  *
647
654
  * | Env variable name | Description | Default | Comments |
648
655
  * | ----------------- | ----------- | ------- | -------- |
649
- * | CACHE_IP | domain of the redis server to use with port | localhost:6379 |
656
+ * | CACHE_IP | domain of the redis server to use with port, a comma seperated list if using cluster | localhost:6379 |
650
657
  * | CACHE_USER | redis user if the redis service is auth protected | null |
651
658
  * | CACHE_PASSWORD | redis password for the user if the redis service is auth protected | null |
659
+ * | CACHE_CLUSTER_SET | set on, when using redis in a cluster. | off |
660
+ * | CACHE_CLUSTER_USE_REPLICAS | When set on, distribute load by executing readonly commands (such as GET) across all cluster nodes. When false, only use master nodes | off |
661
+ * | CACHE_CLUSTER_MINIMIZE_CONNECTION | When set on, .connect() will only discover the cluster topology, without actually connecting to all the nodes. Useful for short-term or Pub/Sub-only connections. | off |
652
662
  * | CACHE_CONNECTION_TIMEOUT | time the server will wait at start to connect to the cache | 30 | in seconds
653
663
  * | CACHE_VALIDATION_CHECK | the delay before checking for connection | 1000 | in ms
654
664
  * | CACHE_RECONNECTION_OFFSET | offset for the time to reconnect to the database before error is generated | 5 | in seconds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimik/configuration",
3
- "version": "5.0.6",
3
+ "version": "5.0.7",
4
4
  "description": "Common configuration for mimik services",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,12 +35,12 @@
35
35
  "@mimik/user-filters": "1.3.6",
36
36
  "ip": "2.0.0",
37
37
  "lodash": "4.17.21",
38
- "uuid": "9.0.0"
38
+ "uuid": "9.0.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@mimik/eslint-plugin-dependencies": "^2.4.5",
42
42
  "@mimik/eslint-plugin-document-env": "^1.0.5",
43
- "eslint": "8.48.0",
43
+ "eslint": "8.50.0",
44
44
  "eslint-config-airbnb": "19.0.4",
45
45
  "eslint-plugin-import": "2.28.1",
46
46
  "eslint-plugin-jsx-a11y": "6.7.1",