feat(script): 增加大区时自动处理代码的脚本和模板

This commit is contained in:
liangtongchuan
2023-04-27 18:35:59 +08:00
parent 53b6c4197e
commit c68f139cbf
6 changed files with 652 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
import defaultConfig from './config.default';
export default (appInfo: EggAppInfo) => {
const config = {} as PowerPartial<EggAppConfig>;
config.middleware = [ 'parmsDecode', 'getIp', 'proxy' ];
config.mongoose = {
url: 'MONGO_URL', // 内网
options: { useNewUrlParser: true, useUnifiedTopology: true },
};
config.gmmongoose = {
url: 'GM_MONGO_URL', // 内网
options: { useNewUrlParser: true, useUnifiedTopology: true },
};
config.redis = {
url: 'REDIS_URL', // 内网
pw: 'REDIS_PASS'
};
config.xtransit = {
server: 'WEB_MONITOR_SERVER_URL',
appId: 'WEB_MONITOR_ID',
appSecret: 'WEB_MONITOR_SECRET'
};
config.customLogger = {
linkLogger: {
file: '/zyz_logs/web-server/link-log.log',
formatter(meta) {
return `[${meta.level}] [${meta.date}] ${meta.message}`;
},
},
};
config.logrotator = {
filesRotateBySize: [
'/zyz_logs/web-server/link-log.log',
],
maxFileSize: 1024 * 1024 * 1024,
};
// the return config will combines to EggAppConfig
return {
...defaultConfig(appInfo),
...config
};
};