vona-cli-set-api 1.0.331 → 1.0.335

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.
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "vona": "^5.0.193"
49
+ "vona": "^5.0.195"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cabloy/lint": "^5.0.16",
@@ -3,6 +3,11 @@ import type { VonaAppInfo, VonaConfigOptional } from 'vona';
3
3
  export default function (_appInfo: VonaAppInfo) {
4
4
  const config = {} as VonaConfigOptional;
5
5
 
6
+ // proxy
7
+ config.proxy = {
8
+ enable: false,
9
+ };
10
+
6
11
  // instances
7
12
  config.instances = [
8
13
  { name: '', password: '', title: '' },
@@ -2,7 +2,7 @@ import type { ILoggerOptionsClientInfo, VonaAppInfo, VonaApplication, VonaConfig
2
2
  import type { IDatabaseClientRecord } from 'vona-module-a-orm';
3
3
  import type * as Winston from 'winston';
4
4
  import { replaceTemplate } from '@cabloy/utils';
5
- import { formatLoggerAxiosError, formatLoggerCtx } from 'vona';
5
+ import { formatLoggerAxiosError, formatLoggerCtx, getLoggerPathPhysicalRoot, getPublicPathPhysicalRoot } from 'vona';
6
6
 
7
7
  declare module 'vona' {
8
8
  export interface IInstanceRecord {
@@ -17,9 +17,45 @@ declare module 'vona-module-a-orm' {
17
17
  }
18
18
  }
19
19
 
20
- export default function (_appInfo: VonaAppInfo, env: VonaConfigEnv) {
20
+ export default function (appInfo: VonaAppInfo, env: VonaConfigEnv) {
21
21
  const config = {} as VonaConfigOptional;
22
22
 
23
+ // meta
24
+ config.meta = {
25
+ flavor: appInfo.configMeta.flavor,
26
+ mode: appInfo.configMeta.mode,
27
+ };
28
+
29
+ // server
30
+ const publicDir = env.SERVER_PUBLICDIR || getPublicPathPhysicalRoot(appInfo);
31
+ const loggerDir = env.SERVER_LOGGERDIR || getLoggerPathPhysicalRoot(appInfo);
32
+ const subdomainOffset = Number.parseInt(env.SERVER_SUBDOMAINOFFSET || '1');
33
+ const workers = Number.parseInt(env.SERVER_WORKERS!);
34
+ config.server = {
35
+ keys: (env.SERVER_KEYS || '').split(','),
36
+ globalPrefix: env.SERVER_GLOBALPREFIX || '/api',
37
+ publicDir,
38
+ loggerDir,
39
+ subdomainOffset,
40
+ workers,
41
+ listen: {
42
+ hostname: env.SERVER_LISTEN_HOSTNAME,
43
+ port: Number.parseInt(env.SERVER_LISTEN_PORT!),
44
+ disable: env.SERVER_LISTEN_DISABLE === 'true',
45
+ },
46
+ serve: {},
47
+ };
48
+
49
+ // proxy
50
+ config.proxy = {
51
+ enable: true,
52
+ ipHeaders: 'x-real-ip,x-forwarded-for',
53
+ hostHeaders: 'x-forwarded-host,host',
54
+ protocolHeaders: 'x-forwarded-proto',
55
+ maxProxyCount: 1,
56
+ maxIpsCount: 15,
57
+ };
58
+
23
59
  // logger
24
60
  config.logger = {
25
61
  rotate: {
@@ -45,7 +81,18 @@ export default function (_appInfo: VonaAppInfo, env: VonaConfigEnv) {
45
81
  transports: undefined,
46
82
  };
47
83
  },
48
- clients: {},
84
+ clients: {
85
+ default(this: VonaApplication, clientInfo: ILoggerOptionsClientInfo) {
86
+ const transports = [
87
+ this.bean.logger.makeTransportFile(clientInfo, 'error', 'error'),
88
+ this.bean.logger.makeTransportFile(clientInfo, 'warn', 'warn'),
89
+ this.bean.logger.makeTransportFile(clientInfo, 'http', 'http'),
90
+ this.bean.logger.makeTransportFile(clientInfo, 'combined'),
91
+ this.bean.logger.makeTransportConsole(clientInfo),
92
+ ].filter(item => !!item);
93
+ return { transports };
94
+ },
95
+ },
49
96
  };
50
97
 
51
98
  // redis
@@ -58,7 +105,16 @@ export default function (_appInfo: VonaAppInfo, env: VonaConfigEnv) {
58
105
  maxRetriesPerRequest: null,
59
106
  enableReadyCheck: false,
60
107
  },
61
- clients: {},
108
+ clients: {
109
+ default: { keyPrefix: `default_${appInfo.name}:` },
110
+ redlock: {},
111
+ queue: {},
112
+ broadcast: {},
113
+ cache: { keyPrefix: `cache_${appInfo.name}:` },
114
+ io: { keyPrefix: `io_${appInfo.name}:` },
115
+ summer: { keyPrefix: `summer_${appInfo.name}:` },
116
+ model: { keyPrefix: `model_${appInfo.name}:` },
117
+ },
62
118
  };
63
119
 
64
120
  // 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.331",
4
+ "version": "1.0.335",
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.88",
64
+ "vona-core": "^5.0.90",
65
65
  "why-is-node-running": "^3.2.2",
66
66
  "yargs-parser": "^21.1.1"
67
67
  },