From 74cf6af38e97c0bd433c0c20aa21c038c455dc53 Mon Sep 17 00:00:00 2001 From: luying Date: Sat, 31 Jul 2021 18:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=EF=BC=9A=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=9C=8D=E8=BF=9E=E6=8E=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gm-server/config/config.alpha.ts | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 gm-server/config/config.alpha.ts diff --git a/gm-server/config/config.alpha.ts b/gm-server/config/config.alpha.ts new file mode 100644 index 000000000..af09db888 --- /dev/null +++ b/gm-server/config/config.alpha.ts @@ -0,0 +1,76 @@ +import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg'; +const path = require('path'); + +export default (appInfo: EggAppInfo) => { + const config = {} as PowerPartial; + + // 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 { + ...config, + ...bizConfig, + }; +};