athene-api
Advanced tools
@@ -17,2 +17,3 @@ export declare const APP_CONFIG: { | ||
| GetConfig(key: string): any; | ||
| GetSafeConfig(key: string): any; | ||
| /** | ||
@@ -19,0 +20,0 @@ * 获取Api地址 |
@@ -78,2 +78,16 @@ "use strict"; | ||
| } | ||
| GetSafeConfig(key) { | ||
| try { | ||
| const keyPath = key.split(':'); | ||
| let cfg = exports.APP_CONFIG[keyPath[0]]; | ||
| for (let index = 1; index < keyPath.length; index++) { | ||
| const element = keyPath[index]; | ||
| cfg = cfg[element]; | ||
| } | ||
| return cfg; | ||
| } | ||
| catch (ex) { | ||
| return undefined; | ||
| } | ||
| } | ||
| /** | ||
@@ -80,0 +94,0 @@ * 获取Api地址 |
@@ -54,2 +54,3 @@ "use strict"; | ||
| InitMiddleware() { | ||
| var _a; | ||
| this._moduleLoader.LoadProxy(this._controllerPath, this._server); | ||
@@ -86,2 +87,3 @@ // 异常处理中间件 | ||
| // ); | ||
| // console.log("this.settingManager.GetSafeConfig('maxFileSize') ", this.settingManager.GetSafeConfig('maxFileSize')); | ||
| this._app.use(koaBody({ | ||
@@ -92,3 +94,3 @@ // strict: false, | ||
| formidable: { | ||
| maxFileSize: 200 * 1024 * 1024, // 设置上传文件大小最大限制,默认2M | ||
| maxFileSize: (_a = this.settingManager.GetSafeConfig('maxFileSize')) !== null && _a !== void 0 ? _a : 200 * 1024 * 1024, // 设置上传文件大小最大限制,默认2M | ||
| }, | ||
@@ -110,2 +112,3 @@ })); | ||
| this.Init(); | ||
| // this.InitMiddleware(); | ||
| if (!port) | ||
@@ -112,0 +115,0 @@ port = this.settingManager.GetConfig('port'); |
+1
-1
| { | ||
| "name": "athene-api", | ||
| "version": "2.0.17", | ||
| "version": "2.0.18", | ||
| "description": "athene-api", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
428664
0.16%9367
0.19%27
3.85%