mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2025-12-12 17:42:49 +00:00
优化
This commit is contained in:
parent
2ca58b4f88
commit
5646c7ada7
@ -27,7 +27,7 @@ function isPortAvailableSync(port: number): boolean {
|
|||||||
* @param {number} startPort - 起始端口
|
* @param {number} startPort - 起始端口
|
||||||
* @returns {number} - 可用的端口
|
* @returns {number} - 可用的端口
|
||||||
*/
|
*/
|
||||||
export function checkPort(startPort: number): number {
|
export function availablePort(startPort: number): number {
|
||||||
let port = startPort;
|
let port = startPort;
|
||||||
while (port <= 65535) {
|
while (port <= 65535) {
|
||||||
if (isPortAvailableSync(port)) {
|
if (isPortAvailableSync(port)) {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { MidwayConfig } from '@midwayjs/core';
|
|||||||
import { CoolCacheStore } from '@cool-midway/core';
|
import { CoolCacheStore } from '@cool-midway/core';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { pCachePath, pUploadPath } from '../comm/path';
|
import { pCachePath, pUploadPath } from '../comm/path';
|
||||||
import { checkPort } from '../comm/port';
|
import { availablePort } from '../comm/port';
|
||||||
|
|
||||||
// redis缓存
|
// redis缓存
|
||||||
// import { redisStore } from 'cache-manager-ioredis-yet';
|
// import { redisStore } from 'cache-manager-ioredis-yet';
|
||||||
@ -12,7 +12,7 @@ export default {
|
|||||||
// 确保每个项目唯一,项目首次启动会自动生成
|
// 确保每个项目唯一,项目首次启动会自动生成
|
||||||
keys: '576848ea-bb0c-4c0c-ac95-c8602ef908b5',
|
keys: '576848ea-bb0c-4c0c-ac95-c8602ef908b5',
|
||||||
koa: {
|
koa: {
|
||||||
port: checkPort(8001),
|
port: availablePort(8001),
|
||||||
},
|
},
|
||||||
// 开启异步上下文管理
|
// 开启异步上下文管理
|
||||||
asyncContextManager: {
|
asyncContextManager: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user