@samet-it/be-redis-common 1.3.3 → 1.3.4

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/README.md CHANGED
@@ -28,7 +28,7 @@ npm i @samet-it/be-redis-common
28
28
  ```
29
29
 
30
30
  ## Environments
31
- - [RedisCommonConf](./src/config/redis-common.config.ts)
31
+ - [RedisCommonConf](./src/config/redis-common.env.ts)
32
32
 
33
33
  | Name | Type | Default | Required | Secret | Description |
34
34
  |-------------------|---------|---------|----------|--------|--------------------------|
@@ -1,3 +1,3 @@
1
- export * from './index.types.js';
2
- export * from './redis.channel.js';
3
- export * from './redis-direct.channel.js';
1
+ export * from "./index.types.js";
2
+ export * from "./redis.channel.js";
3
+ export * from "./redis-direct.channel.js";
@@ -1,3 +1,3 @@
1
- export * from './index.types.js';
2
- export * from './redis.channel.js';
3
- export * from './redis-direct.channel.js';
1
+ export * from "./index.types.js";
2
+ export * from "./redis.channel.js";
3
+ export * from "./redis-direct.channel.js";
@@ -17,7 +17,7 @@ export class RedisDirectChannel extends RedisChannel {
17
17
  * */
18
18
  constructor(conn, opt) {
19
19
  super(conn, opt);
20
- this.logger = logCommon.of(`RedisDirect${opt.name ? '#' + opt.name : ''}`);
20
+ this.logger = logCommon.of(`RedisDirect${opt.name ? "#" + opt.name : ""}`);
21
21
  }
22
22
  }
23
23
  setFqn(RedisDirectChannel, FQN);
@@ -36,14 +36,14 @@ export class RedisChannel extends CacheChannel {
36
36
  if (!this.isConnected) {
37
37
  return undefined;
38
38
  }
39
- if (typeof path !== 'string') {
39
+ if (typeof path !== "string") {
40
40
  return undefined;
41
41
  }
42
42
  try {
43
- return await this.client.get(path);
43
+ return (await this.client.get(path));
44
44
  }
45
45
  catch (e) {
46
- this.checkError(e, { name: 'GET', method: '$get' });
46
+ this.checkError(e, { name: "GET", method: "$get" });
47
47
  }
48
48
  return undefined;
49
49
  }
@@ -61,7 +61,7 @@ export class RedisChannel extends CacheChannel {
61
61
  return rec ? [rec] : [];
62
62
  }
63
63
  catch (e) {
64
- this.checkError(e, { name: 'GET', method: '$getMore' });
64
+ this.checkError(e, { name: "GET", method: "$getMore" });
65
65
  return [];
66
66
  }
67
67
  }
@@ -69,7 +69,7 @@ export class RedisChannel extends CacheChannel {
69
69
  return (await this.client.mGet(paths));
70
70
  }
71
71
  catch (e) {
72
- this.checkError(e, { name: 'MGET', method: '$getMore' });
72
+ this.checkError(e, { name: "MGET", method: "$getMore" });
73
73
  return [];
74
74
  }
75
75
  }
@@ -78,7 +78,7 @@ export class RedisChannel extends CacheChannel {
78
78
  if (!this.isConnected) {
79
79
  return false;
80
80
  }
81
- if (typeof path !== 'string' || typeof value !== 'string') {
81
+ if (typeof path !== "string" || typeof value !== "string") {
82
82
  return false;
83
83
  }
84
84
  try {
@@ -86,7 +86,7 @@ export class RedisChannel extends CacheChannel {
86
86
  return true;
87
87
  }
88
88
  catch (e) {
89
- this.checkError(e, { name: 'SET', method: '$set' });
89
+ this.checkError(e, { name: "SET", method: "$set" });
90
90
  }
91
91
  return false;
92
92
  }
@@ -95,20 +95,21 @@ export class RedisChannel extends CacheChannel {
95
95
  if (!this.isConnected) {
96
96
  return 0;
97
97
  }
98
- if (!map || typeof map !== 'object' || Array.isArray(map)) {
98
+ if (!map || typeof map !== "object" || Array.isArray(map)) {
99
99
  return 0;
100
100
  }
101
101
  const keys = Object.keys(map);
102
+ let key;
102
103
  switch (keys.length) {
103
104
  case 0:
104
105
  return 0;
105
106
  case 1:
106
- const key = keys[0];
107
+ key = keys[0];
107
108
  try {
108
109
  await this.client.set(key, map[key]);
109
110
  }
110
111
  catch (e) {
111
- this.checkError(e, { name: 'SET', method: '$setMore' });
112
+ this.checkError(e, { name: "SET", method: "$setMore" });
112
113
  }
113
114
  return 1;
114
115
  default:
@@ -116,7 +117,7 @@ export class RedisChannel extends CacheChannel {
116
117
  await this.client.mSet(map);
117
118
  }
118
119
  catch (e) {
119
- this.checkError(e, { name: 'MSET', method: '$setMore' });
120
+ this.checkError(e, { name: "MSET", method: "$setMore" });
120
121
  }
121
122
  return keys.length;
122
123
  }
@@ -126,7 +127,7 @@ export class RedisChannel extends CacheChannel {
126
127
  if (!this.isConnected) {
127
128
  return false;
128
129
  }
129
- if (typeof path !== 'string') {
130
+ if (typeof path !== "string") {
130
131
  return false;
131
132
  }
132
133
  try {
@@ -134,7 +135,7 @@ export class RedisChannel extends CacheChannel {
134
135
  return result > 0;
135
136
  }
136
137
  catch (e) {
137
- this.checkError(e, { name: 'DEL', method: '$delete' });
138
+ this.checkError(e, { name: "DEL", method: "$delete" });
138
139
  }
139
140
  return false;
140
141
  }
@@ -150,7 +151,7 @@ export class RedisChannel extends CacheChannel {
150
151
  await this.client.del(paths);
151
152
  }
152
153
  catch (e) {
153
- this.checkError(e, { name: 'DEL', method: '$deleteMore' });
154
+ this.checkError(e, { name: "DEL", method: "$deleteMore" });
154
155
  }
155
156
  return paths.length;
156
157
  }
@@ -166,7 +167,7 @@ export class RedisChannel extends CacheChannel {
166
167
  await this.client.sAdd(idPath, paths);
167
168
  }
168
169
  catch (e) {
169
- this.checkError(e, { name: 'SADD', method: '$addLinks' });
170
+ this.checkError(e, { name: "SADD", method: "$addLinks" });
170
171
  }
171
172
  return paths.length;
172
173
  }
@@ -179,7 +180,7 @@ export class RedisChannel extends CacheChannel {
179
180
  return (await this.client.expire(path, seconds)) > 0;
180
181
  }
181
182
  catch (e) {
182
- this.checkError(e, { name: 'EXPIRE', method: '$expire' });
183
+ this.checkError(e, { name: "EXPIRE", method: "$expire" });
183
184
  }
184
185
  }
185
186
  /** @inheritDoc */
@@ -191,7 +192,7 @@ export class RedisChannel extends CacheChannel {
191
192
  return (await this.client.sMembers(idPath)) ?? [];
192
193
  }
193
194
  catch (e) {
194
- this.checkError(e, { name: 'SMEMBERS', method: '$getLinks' });
195
+ this.checkError(e, { name: "SMEMBERS", method: "$getLinks" });
195
196
  }
196
197
  }
197
198
  }
@@ -1,2 +1,2 @@
1
- export * from './redis-common.config.js';
2
- export * from './index.types.js';
1
+ export * from "./redis-common.env.js";
2
+ export * from "./index.types.js";
@@ -1,2 +1,2 @@
1
- export * from './redis-common.config.js';
2
- export * from './index.types.js';
1
+ export * from "./redis-common.env.js";
2
+ export * from "./index.types.js";
@@ -1,5 +1,5 @@
1
1
  import { EnvBase } from "@samet-it/be-base-common";
2
- export interface RedisCommonConf extends EnvBase {
2
+ export interface RedisCommonEnv extends EnvBase {
3
3
  /**
4
4
  * Redis Enabled
5
5
  * */
@@ -0,0 +1,5 @@
1
+ import { RedisCommonEnv } from "./index.types.js";
2
+ /**
3
+ * Redis common config
4
+ * */
5
+ export declare const redisCommonEnv: import("@samet-it/be-base-common").EnvScopeRuntime<RedisCommonEnv, "REDIS", undefined>;
@@ -0,0 +1,45 @@
1
+ import { envCore } from "@samet-it/be-base-common";
2
+ /**
3
+ * Redis common config
4
+ * */
5
+ export const redisCommonEnv = envCore.configure
6
+ .scope("RedisCommonEnv", "REDIS")
7
+ .start()
8
+ // @formatter:off
9
+ .field("ENABLED")
10
+ .boolean()
11
+ .def(true)
12
+ .end()
13
+ .field("PROTOCOL")
14
+ .off((v) => !v.ENABLED)
15
+ .text()
16
+ .def("redis")
17
+ .end()
18
+ .field("HOST")
19
+ .off((v) => !v.ENABLED)
20
+ .text()
21
+ .required()
22
+ .end()
23
+ .field("PORT")
24
+ .off((v) => !v.ENABLED)
25
+ .integer()
26
+ .def(6379)
27
+ .end()
28
+ .field("USER")
29
+ .off((v) => !v.ENABLED)
30
+ .text()
31
+ .end()
32
+ .field("PASS")
33
+ .off((v) => !v.ENABLED)
34
+ .text()
35
+ .end()
36
+ .field("PREFIX")
37
+ .off((v) => !v.ENABLED)
38
+ .text()
39
+ .end()
40
+ .field("DB_NUMBER")
41
+ .off((v) => !v.ENABLED)
42
+ .integer()
43
+ .end()
44
+ // @formatter:on
45
+ .finish();
@@ -1,4 +1,4 @@
1
- export * from './index.types.js';
2
- export * from './redis.connection.js';
3
- export * from './redis-direct.connection.js';
4
- export * from './redis-connection.fn.js';
1
+ export * from "./index.types.js";
2
+ export * from "./redis.connection.js";
3
+ export * from "./redis-direct.connection.js";
4
+ export * from "./redis-connection.fn.js";
@@ -1,4 +1,4 @@
1
- export * from './index.types.js';
2
- export * from './redis.connection.js';
3
- export * from './redis-direct.connection.js';
4
- export * from './redis-connection.fn.js';
1
+ export * from "./index.types.js";
2
+ export * from "./redis.connection.js";
3
+ export * from "./redis-direct.connection.js";
4
+ export * from "./redis-connection.fn.js";
@@ -13,7 +13,7 @@ export class RedisDirectConnection extends RedisConnection {
13
13
  * */
14
14
  constructor(opt) {
15
15
  super(opt);
16
- this.logger = logCommon.of(`RedisConnection${opt?.name ? '#' + opt?.name : ''}`);
16
+ this.logger = logCommon.of(`RedisConnection${opt?.name ? "#" + opt?.name : ""}`);
17
17
  }
18
18
  /** @inheritDoc */
19
19
  newChannel(opt) {
@@ -1,4 +1,4 @@
1
- import { RedisClientType } from 'redis';
1
+ import { RedisClientType } from "redis";
2
2
  import { RedisConnectionLike, RedisConnOpt, RedisConnProps } from "./index.types.js";
3
3
  import { CacheConnection } from "@samet-it/be-cache-common";
4
4
  /**
@@ -1,5 +1,5 @@
1
- import * as redis from 'redis';
2
- import { redisCommonConfig } from "../config/index.js";
1
+ import * as redis from "redis";
2
+ import { redisCommonEnv } from "../config/index.js";
3
3
  import { CacheConnection, CacheError } from "@samet-it/be-cache-common";
4
4
  import { errorCommon, logCommon, setFqn } from "@samet-it/be-base-common";
5
5
  import { FQN } from "../internal.js";
@@ -74,9 +74,9 @@ export class RedisConnection extends CacheConnection {
74
74
  * */
75
75
  _readFromEnv() {
76
76
  const { _props: props } = this;
77
- let env = redisCommonConfig.valueShort;
77
+ let env = redisCommonEnv.valueShort;
78
78
  if (props.envVariant) {
79
- env = redisCommonConfig.configure.getVariation(props.envVariant).valueShort;
79
+ env = redisCommonEnv.configure.getVariation(props.envVariant).valueShort;
80
80
  }
81
81
  props.isEnabled = props.isEnabled ?? env.ENABLED;
82
82
  props.protocol = props.protocol ?? env.PROTOCOL;
@@ -91,21 +91,21 @@ export class RedisConnection extends CacheConnection {
91
91
  * */
92
92
  _buildUrl() {
93
93
  const { username, password, dbNumber, port, host, protocol } = this._props;
94
- let _secure = '';
94
+ let _secure = "";
95
95
  if (username) {
96
96
  _secure = username;
97
97
  if (password) {
98
- _secure += ':' + password;
98
+ _secure += ":" + password;
99
99
  }
100
- _secure += '@';
100
+ _secure += "@";
101
101
  }
102
- let _db = '';
102
+ let _db = "";
103
103
  if (dbNumber !== undefined) {
104
- _db = '/' + dbNumber;
104
+ _db = "/" + dbNumber;
105
105
  }
106
- let _port = '';
106
+ let _port = "";
107
107
  if (port !== undefined) {
108
- _port = ':' + port;
108
+ _port = ":" + port;
109
109
  }
110
110
  this._props.producedUrl = `${protocol}://${_secure}${host}${_port}${_db}`;
111
111
  }
@@ -127,30 +127,30 @@ export class RedisConnection extends CacheConnection {
127
127
  return true;
128
128
  }
129
129
  if (this._props.connectTryCount > RedisConnection.CONN_TRY_COUNT) {
130
- const err = new CacheError('Maximum try county', { tryCount: this._props.connectTryCount });
131
- this.logger.error(errorCommon.text(err, 'connect'));
130
+ const err = new CacheError("Maximum try county", { tryCount: this._props.connectTryCount });
131
+ this.logger.error(errorCommon.text(err, "connect"));
132
132
  return false;
133
133
  }
134
134
  try {
135
135
  props.client = redis.createClient({ url: this._props.producedUrl });
136
136
  props.client
137
- .on("error", err => {
138
- this.logger.warn(errorCommon.text(err, 'connection', this._props.connectTryCount));
137
+ .on("error", (err) => {
138
+ this.logger.warn(errorCommon.text(err, "connection", this._props.connectTryCount));
139
139
  props.connectTryCount++;
140
140
  const old = this.isConnected;
141
141
  props.isConnected = false;
142
142
  if (old) {
143
- this._triggerOnCase('disconnected', this._onDisconnected, false);
143
+ this._triggerOnCase("disconnected", this._onDisconnected, false);
144
144
  }
145
145
  setTimeout(() => this.connect().then(), this._connectionDelay);
146
146
  })
147
- .on('connect', () => {
147
+ .on("connect", () => {
148
148
  this.logger.info(`on[connect]`);
149
149
  props.isConnected = true;
150
150
  props.connectTryCount = 0;
151
- this._triggerOnCase('connected', this._onConnected, false);
151
+ this._triggerOnCase("connected", this._onConnected, false);
152
152
  if (props.isFirst === undefined) {
153
- this._triggerOnCase('first-connected', this._onFirstConnected, true);
153
+ this._triggerOnCase("first-connected", this._onFirstConnected, true);
154
154
  props.isFirst = false;
155
155
  }
156
156
  // clear stopped ping
@@ -159,16 +159,16 @@ export class RedisConnection extends CacheConnection {
159
159
  setTimeout(() => this.ping(true).then(), 30_000);
160
160
  }
161
161
  })
162
- .on('ready', () => this.logger.info('on[ready]'))
163
- .on('close', () => this.logger.info('on[close]'))
164
- .on('reconnecting', () => this.logger.info('on[reconnecting]'))
165
- .on('end', () => this.logger.info('on[end]'));
162
+ .on("ready", () => this.logger.info("on[ready]"))
163
+ .on("close", () => this.logger.info("on[close]"))
164
+ .on("reconnecting", () => this.logger.info("on[reconnecting]"))
165
+ .on("end", () => this.logger.info("on[end]"));
166
166
  await props.client.connect();
167
- this.logger.info('Connected');
167
+ this.logger.info("Connected");
168
168
  setTimeout(() => this.ping(true).then(), 30_000);
169
169
  }
170
170
  catch (e) {
171
- this.logger.warn(errorCommon.text(e, 'connection', this._props.connectTryCount));
171
+ this.logger.warn(errorCommon.text(e, "connection", this._props.connectTryCount));
172
172
  }
173
173
  return true;
174
174
  }
@@ -178,8 +178,8 @@ export class RedisConnection extends CacheConnection {
178
178
  return false;
179
179
  }
180
180
  if (this._props.pingTryCount > RedisConnection.PING_TRY_COUNT) {
181
- const err = new CacheError('Maximum try county', { tryCount: this._props.pingTryCount });
182
- this.logger.error(errorCommon.text(err, 'connect'));
181
+ const err = new CacheError("Maximum try county", { tryCount: this._props.pingTryCount });
182
+ this.logger.error(errorCommon.text(err, "connect"));
183
183
  return false;
184
184
  }
185
185
  let result = false;
@@ -191,7 +191,7 @@ export class RedisConnection extends CacheConnection {
191
191
  }
192
192
  catch (err) {
193
193
  this._props.pingTryCount++;
194
- this.logger.warn(errorCommon.text(err, 'ping', this._props.pingTryCount));
194
+ this.logger.warn(errorCommon.text(err, "ping", this._props.pingTryCount));
195
195
  setTimeout(() => this.ping(true).then(), this._pingDelay);
196
196
  next = false;
197
197
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './connection/index.js';
2
- export * from './config/index.js';
3
- export * from './channel/index.js';
4
- export * from './index.foretell.js';
5
- export * from './index.loader.js';
1
+ export * from "./connection/index.js";
2
+ export * from "./config/index.js";
3
+ export * from "./channel/index.js";
4
+ export * from "./index.foretell.js";
5
+ export * from "./index.loader.js";
@@ -1 +1 @@
1
- export declare const foretell_sametRedisCommon: any[];
1
+ export declare const foretell_sametRedisCommon: (() => void)[];
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * from './connection/index.js';
2
- export * from './config/index.js';
3
- export * from './channel/index.js';
4
- export * from './index.foretell.js';
5
- export * from './index.loader.js';
1
+ export * from "./connection/index.js";
2
+ export * from "./config/index.js";
3
+ export * from "./channel/index.js";
4
+ export * from "./index.foretell.js";
5
+ export * from "./index.loader.js";
@@ -7,4 +7,4 @@ export const loader_sametRedisCommon = defineLoader(FQN,
7
7
  // dependencies
8
8
  ...loader_sametBaseCommon, ...loader_sametCacheCommon,
9
9
  // classes
10
- () => import('./channel/redis.channel.js').then(m => m.RedisChannel), () => import('./channel/redis-direct.channel.js').then(m => m.RedisDirectChannel), () => import('./connection/redis.connection.js').then(m => m.RedisConnection), () => import('./connection/redis-direct.connection.js').then(m => m.RedisDirectConnection), () => import('./config/redis-common.config.js').then(m => m.redisCommonConfig));
10
+ () => import("./channel/redis.channel.js").then((m) => m.RedisChannel), () => import("./channel/redis-direct.channel.js").then((m) => m.RedisDirectChannel), () => import("./connection/redis.connection.js").then((m) => m.RedisConnection), () => import("./connection/redis-direct.connection.js").then((m) => m.RedisDirectConnection), () => import("./config/redis-common.env.js").then((m) => m.redisCommonEnv));
@@ -1 +1 @@
1
- export declare const NME: string, FQN: string, VER: string, CNF: import("@samet-it/be-base-common").LeyyoConfig;
1
+ export declare const NME: string, FQN: string, VER: string;
package/dist/internal.js CHANGED
@@ -1,2 +1,3 @@
1
- import { sysAll } from "@samet-it/be-base-common";
2
- export const { pck: { name: NME, fqn: FQN, version: VER }, config: CNF } = sysAll(import.meta.url);
1
+ import { packageJson } from "@leyyo/common";
2
+ // noinspection JSUnusedGlobalSymbols
3
+ export const { name: NME, fqn: FQN, version: VER } = packageJson(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samet-it/be-redis-common",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Redis common component",
5
5
  "keywords": [
6
6
  "redis",
@@ -22,54 +22,40 @@
22
22
  "main": "dist/index.js",
23
23
  "type": "module",
24
24
  "scripts": {
25
- "clear": "rimraf dist && rimraf coverage",
26
- "clear:nm": "rimraf node_modules && npm run clear",
27
- "lint": "eslint src/**/*.ts --quiet",
28
- "lint:verbose": "eslint src/**/*.ts",
25
+ "clear": "rimraf dist",
26
+ "lint": "eslint src/**/*.ts",
27
+ "lint:fix": "eslint src/**/*.ts --fix",
28
+ "format": "prettier --check \"{src,test}/**/*.{ts,tsx,js}\"",
29
+ "format:force": "prettier --write \"{src,test}/**/*.{ts,tsx,js}\"",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "test:coverage": "vitest run --coverage",
29
33
  "asset": "node -r ts-node/register commands/assets.js",
30
34
  "build": "npm run clear && tsc && npm run asset",
31
- "test": "jest --config=jest.json --detectOpenHandles",
32
- "coverage": "rimraf coverage && jest --config=jest.json --coverage --coverageDirectory=coverage",
33
- "sample": "node -r ts-node/register src/sample.ts",
34
- "publish:public": "npm run build && npm publish -access=public"
35
+ "publish:public": "npm run lint && npm run format:force && npm run test && npm run build && npm publish --access=public"
35
36
  },
36
37
  "files": [
37
38
  "dist/*"
38
39
  ],
39
40
  "license": "ISC",
40
41
  "devDependencies": {
41
- "@babel/preset-env": "^7.28.0",
42
- "@babel/preset-typescript": "^7.27.1",
43
- "@eslint/js": "^9.33.0",
44
- "@types/express": "^5.0.6",
45
- "@types/jest": "^30.0.0",
42
+ "@eslint/js": "^9.0.0",
46
43
  "@types/node": "^24.2.1",
47
- "@typescript-eslint/eslint-plugin": "^8.39.1",
48
- "@typescript-eslint/parser": "^8.39.1",
49
- "eslint": "^9.33.0",
44
+ "@vitest/coverage-istanbul": "^4.0.18",
45
+ "eslint": "^9.0.0",
50
46
  "eslint-config-prettier": "^10.1.8",
51
- "eslint-config-standard": "^17.1.0",
52
- "eslint-plugin-import": "^2.32.0",
53
- "eslint-plugin-jsdoc": "^54.0.0",
54
- "eslint-plugin-node": "^11.1.0",
55
- "husky": "^9.1.7",
56
- "jest": "^29.7.0",
57
- "prettier": "^3.6.2",
47
+ "eslint-plugin-n": "^17.24.0",
48
+ "prettier": "^3.8.1",
58
49
  "rimraf": "^6.0.1",
59
- "test": "^3.3.0",
60
- "ts-jest": "^29.4.1",
61
50
  "ts-node": "^10.9.2",
62
- "typescript": "^5.9.2",
63
- "typescript-eslint": "^8.39.1"
64
- },
65
- "overrides": {
66
- "eslint-config-standard": {
67
- "eslint": "^9.33.0"
68
- }
51
+ "typescript": "^5.9.3",
52
+ "typescript-eslint": "^8.0.0",
53
+ "vitest": "^4.0.18",
54
+ "@types/express": "^5.0.6"
69
55
  },
70
56
  "dependencies": {
71
- "@samet-it/be-base-common": "^1.3.6",
72
- "@samet-it/be-cache-common": "^1.3.7",
57
+ "@samet-it/be-base-common": "^1.3.8",
58
+ "@samet-it/be-cache-common": "^1.3.8",
73
59
  "redis": "^5.10.0"
74
60
  }
75
61
  }
@@ -1,5 +0,0 @@
1
- import { RedisCommonConf } from "./index.types.js";
2
- /**
3
- * Redis common config
4
- * */
5
- export declare const redisCommonConfig: import("@samet-it/be-base-common").EnvScopeRuntime<RedisCommonConf, "REDIS", undefined>;
@@ -1,32 +0,0 @@
1
- import { envCore } from "@samet-it/be-base-common";
2
- /**
3
- * Redis common config
4
- * */
5
- export const redisCommonConfig = envCore.configure
6
- .scope('RedisCommon', 'REDIS')
7
- .start()
8
- // @formatter:off
9
- .field('ENABLED').boolean().def(true).end()
10
- .field('PROTOCOL')
11
- .off(v => !v.ENABLED)
12
- .text().def('redis').end()
13
- .field('HOST')
14
- .off(v => !v.ENABLED)
15
- .text().required().end()
16
- .field('PORT')
17
- .off(v => !v.ENABLED)
18
- .integer().def(6379).end()
19
- .field('USER')
20
- .off(v => !v.ENABLED)
21
- .text().end()
22
- .field('PASS')
23
- .off(v => !v.ENABLED)
24
- .text().end()
25
- .field('PREFIX')
26
- .off(v => !v.ENABLED)
27
- .text().end()
28
- .field('DB_NUMBER')
29
- .off(v => !v.ENABLED)
30
- .integer().end()
31
- // @formatter:on
32
- .finish();