后台:独立数据库,路径转发

This commit is contained in:
luying
2021-11-22 19:56:16 +08:00
parent 9d9ed77423
commit 7940e6d09d
16 changed files with 256 additions and 303 deletions

View File

@@ -1,76 +1,19 @@
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
const path = require('path');
import defaultConfig from './config.default';
export default (appInfo: EggAppInfo) => {
const config = {} as PowerPartial<EggAppConfig>;
// override config from framework / plugin
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1600244957952_7142';
// add your egg config in here
config.middleware = ['log'];
config.cluster = {
listen: {
port: 7500
}
};
// add your special config in here
const bizConfig = {
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
};
config.mongoose = {
url: 'mongodb://dbop:zyzDev2021@dds-8vb5c74ba4263da41.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb5c74ba4263da42.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-506991391', // 内网
options: { useNewUrlParser: true, useUnifiedTopology: true },
};
config.security = {
csrf: {
enable: false,
ignoreJSON: true
},
domainWhiteList: ['http://localhost:9000']
};
// 配置上传
config.multipart = {
fileSize: '100mb',
mode: 'stream',
whitelist: [
'.json', '.ts', '.zip'
],
fileExtensions: ['.json', '.ts', '.zip', '.tar.gz'], // 扩展几种上传的文件格式
autoFields: true
};
// config.alinode = {
// appid: '86043',
// secret: '54ef0364995b0c4f2ab42150e29ad30df8327a3a',
// error_log: [ '/root/logs/zyz/zyz-web.log', '/root/logs/zyz/common-error.log', '/root/logs/zyz/egg-agent.log' ],
// packages: [ '/root/zyz/web-server/package.json' ],
// };
config.customLogger = {
linkLogger: {
file: path.join(appInfo.root, 'logs/gm-server/link-log.log'),
formatter(meta) {
return `[${meta.level}] [${meta.date}] ${meta.message}`;
},
},
};
config.logrotator = {
filesRotateBySize: [
path.join(appInfo.root, 'logs/link-log.log'),
],
maxFileSize: 1024,
};
// the return config will combines to EggAppConfig
return {
...defaultConfig(appInfo),
...config,
...bizConfig,
};
};