cool-admin-midway/src/config/config.default.ts
2025-01-15 20:48:15 +08:00

73 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { CoolConfig } from '@cool-midway/core';
import { MidwayConfig } from '@midwayjs/core';
import { CoolCacheStore } from '@cool-midway/core';
import * as path from 'path';
import { getUploadDir } from '../modules/plugin/hooks/upload';
// redis缓存
// import { redisStore } from 'cache-manager-ioredis-yet';
export default {
// use for cookie sign key, should change to your own and keep security
keys: '576848ea-bb0c-4c0c-ac95-c8602ef908b5',
koa: {
port: 8001,
},
// 静态文件配置
staticFile: {
buffer: true,
dirs: {
default: {
prefix: '/public',
dir: path.join(__dirname, '..', '..', 'public'),
},
static: {
prefix: '/upload',
dir: getUploadDir(),
},
},
},
// 文件上传
upload: {
fileSize: '200mb',
whitelist: null,
},
// 缓存 可切换成其他缓存如redis http://www.midwayjs.org/docs/extensions/caching
cacheManager: {
clients: {
default: {
store: CoolCacheStore,
options: {
path: 'cache',
ttl: 0,
},
},
},
},
// cacheManager: {
// clients: {
// default: {
// store: redisStore,
// options: {
// port: 6379,
// host: '127.0.0.1',
// password: '',
// ttl: 0,
// db: 0,
// },
// },
// },
// },
cool: {
// 已经插件化,本地文件上传查看 plugin/config.ts其他云存储查看对应插件的使用
file: {},
// crud配置
crud: {
// 插入模式save不会校验字段(允许传入不存在的字段)insert会校验字段
upsert: 'save',
// 软删除
softDelete: true,
},
} as CoolConfig,
} as MidwayConfig;