@common-stack/frontend-stack-react 4.0.1-alpha.28 → 4.0.1-alpha.31
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Redis from 'ioredis';
|
|
2
|
-
export declare function getRedisClient(): Redis;
|
|
1
|
+
import { Redis, Cluster } from 'ioredis';
|
|
2
|
+
export declare function getRedisClient(logger?: any): Redis | Cluster;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import Redis
|
|
2
|
-
function getRedisClient() {
|
|
1
|
+
import {Cluster,Redis}from'ioredis';import {config}from'./env-config.server.js';let redisClient;
|
|
2
|
+
function getRedisClient(logger) {
|
|
3
3
|
if (!redisClient) {
|
|
4
4
|
// Initialize Redis client if it doesn't exist
|
|
5
|
-
|
|
5
|
+
if (config.REDIS_CLUSTER_ENABLED) {
|
|
6
|
+
if (!config.REDIS_CLUSTER_URL) {
|
|
7
|
+
throw new Error(`No nodes defined for cluster, ${config.REDIS_CLUSTER_URL}`);
|
|
8
|
+
}
|
|
9
|
+
logger?.info('Setting Redis.Cluster connection');
|
|
10
|
+
redisClient = new Cluster(config.REDIS_CLUSTER_URL, this.opts);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
logger?.info('Setting Redis connection');
|
|
14
|
+
redisClient = new Redis(config.REDIS_URL || this.opts);
|
|
15
|
+
}
|
|
16
|
+
return redisClient;
|
|
6
17
|
}
|
|
7
18
|
return redisClient;
|
|
8
19
|
}export{getRedisClient};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import'reflect-metadata';import features from'./modules.js';import {getRedisClient}from'./config/redis-config.server.js';/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
1
|
+
import'reflect-metadata';import {logger}from'@cdm-logger/server';import features from'./modules.js';import {getRedisClient}from'./config/redis-config.server.js';/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
const routeConfig = features.getConfiguredRoutes();
|
|
3
|
-
const redisClient = getRedisClient();
|
|
3
|
+
const redisClient = getRedisClient(logger);
|
|
4
4
|
const loadContext = async (req, res) => {
|
|
5
5
|
const { container, store, apolloClient, services, logger } = req;
|
|
6
6
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/frontend-stack-react",
|
|
3
|
-
"version": "4.0.1-alpha.
|
|
3
|
+
"version": "4.0.1-alpha.31",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"watch": "npm run build:lib:watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@common-stack/client-react": "4.0.1-alpha.
|
|
33
|
-
"@common-stack/core": "4.0.1-alpha.
|
|
32
|
+
"@common-stack/client-react": "4.0.1-alpha.31",
|
|
33
|
+
"@common-stack/core": "4.0.1-alpha.31"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"jest-fetch-mock": "^3.0.3",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"typescript": {
|
|
51
51
|
"definition": "lib/index.d.ts"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e680235a1fdf4247f33ec1203c6e6a391b595a8a"
|
|
54
54
|
}
|