vona-cli-set-api 1.0.329 → 1.0.333
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,5 +1,8 @@
|
|
|
1
|
-
import type { VonaAppInfo, VonaConfigEnv, VonaConfigOptional } from 'vona';
|
|
1
|
+
import type { ILoggerOptionsClientInfo, VonaAppInfo, VonaApplication, VonaConfigEnv, VonaConfigOptional } from 'vona';
|
|
2
2
|
import type { IDatabaseClientRecord } from 'vona-module-a-orm';
|
|
3
|
+
import type * as Winston from 'winston';
|
|
4
|
+
import { replaceTemplate } from '@cabloy/utils';
|
|
5
|
+
import { formatLoggerAxiosError, formatLoggerCtx } from 'vona';
|
|
3
6
|
|
|
4
7
|
declare module 'vona' {
|
|
5
8
|
export interface IInstanceRecord {
|
|
@@ -14,12 +17,51 @@ declare module 'vona-module-a-orm' {
|
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
export default function (
|
|
20
|
+
export default function (appInfo: VonaAppInfo, env: VonaConfigEnv) {
|
|
18
21
|
const config = {} as VonaConfigOptional;
|
|
19
22
|
|
|
23
|
+
// logger
|
|
24
|
+
config.logger = {
|
|
25
|
+
rotate: {
|
|
26
|
+
enable: env.LOGGER_ROTATE_ENABLE === 'true',
|
|
27
|
+
options(filename: string) {
|
|
28
|
+
return {
|
|
29
|
+
filename: replaceTemplate(env.LOGGER_ROTATE_FILENAME!, { filename }),
|
|
30
|
+
datePattern: env.LOGGER_ROTATE_DATEPATTERN,
|
|
31
|
+
maxSize: env.LOGGER_ROTATE_MAXSIZE,
|
|
32
|
+
maxFiles: env.LOGGER_ROTATE_MAXFILES,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
base(this: VonaApplication, _clientInfo: ILoggerOptionsClientInfo, winston: typeof Winston) {
|
|
37
|
+
return {
|
|
38
|
+
format: winston.format.combine(
|
|
39
|
+
formatLoggerAxiosError({ stack: true }),
|
|
40
|
+
formatLoggerCtx(),
|
|
41
|
+
winston.format.errors({ stack: true }),
|
|
42
|
+
winston.format.splat(),
|
|
43
|
+
winston.format.timestamp(),
|
|
44
|
+
),
|
|
45
|
+
transports: undefined,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
clients: {
|
|
49
|
+
default(this: VonaApplication, clientInfo: ILoggerOptionsClientInfo) {
|
|
50
|
+
const transports = [
|
|
51
|
+
this.bean.logger.makeTransportFile(clientInfo, 'error', 'error'),
|
|
52
|
+
this.bean.logger.makeTransportFile(clientInfo, 'warn', 'warn'),
|
|
53
|
+
this.bean.logger.makeTransportFile(clientInfo, 'http', 'http'),
|
|
54
|
+
this.bean.logger.makeTransportFile(clientInfo, 'combined'),
|
|
55
|
+
this.bean.logger.makeTransportConsole(clientInfo),
|
|
56
|
+
].filter(item => !!item);
|
|
57
|
+
return { transports };
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
20
62
|
// redis
|
|
21
63
|
config.redis = {
|
|
22
|
-
|
|
64
|
+
base: {
|
|
23
65
|
host: env.REDIS_DEFAULT_HOST,
|
|
24
66
|
port: Number.parseInt(env.REDIS_DEFAULT_PORT!),
|
|
25
67
|
password: env.REDIS_DEFAULT_PASSWORD,
|
|
@@ -27,7 +69,16 @@ export default function (_appInfo: VonaAppInfo, env: VonaConfigEnv) {
|
|
|
27
69
|
maxRetriesPerRequest: null,
|
|
28
70
|
enableReadyCheck: false,
|
|
29
71
|
},
|
|
30
|
-
clients: {
|
|
72
|
+
clients: {
|
|
73
|
+
default: { keyPrefix: `default_${appInfo.name}:` },
|
|
74
|
+
redlock: {},
|
|
75
|
+
queue: {},
|
|
76
|
+
broadcast: {},
|
|
77
|
+
cache: { keyPrefix: `cache_${appInfo.name}:` },
|
|
78
|
+
io: { keyPrefix: `io_${appInfo.name}:` },
|
|
79
|
+
summer: { keyPrefix: `summer_${appInfo.name}:` },
|
|
80
|
+
model: { keyPrefix: `model_${appInfo.name}:` },
|
|
81
|
+
},
|
|
31
82
|
};
|
|
32
83
|
|
|
33
84
|
// database
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-cli-set-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.333",
|
|
5
5
|
"description": "vona cli-set-api",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"ts-node-maintained": "^10.9.6",
|
|
62
62
|
"urllib": "^4.6.11",
|
|
63
63
|
"uuid": "^11.1.0",
|
|
64
|
-
"vona-core": "^5.0.
|
|
64
|
+
"vona-core": "^5.0.89",
|
|
65
65
|
"why-is-node-running": "^3.2.2",
|
|
66
66
|
"yargs-parser": "^21.1.1"
|
|
67
67
|
},
|