后台:web-server连接数据库
This commit is contained in:
@@ -25,8 +25,8 @@ export default (app: Application) => {
|
||||
|
||||
|
||||
router.post('/api/users/getuserlist',tokenParser, controller.users.getuserlist);
|
||||
router.post('/api/users/createrole',tokenParser, controller.users.createRole);
|
||||
router.post('/api/users/addauth', tokenParser, controller.users.addAuth);
|
||||
// router.post('/api/users/createrole',tokenParser, controller.users.createRole);
|
||||
// router.post('/api/users/addauth', tokenParser, controller.users.addAuth);
|
||||
router.post('/api/users/fixsms', tokenParser, controller.users.fixSms);
|
||||
router.post('/api/users/deleterole',tokenParser, controller.users.deleteRole);
|
||||
router.post('/api/users/getrolelist',tokenParser, controller.users.getrolelist);
|
||||
|
||||
@@ -90,6 +90,7 @@ export default (appInfo: EggAppInfo) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
config.proxy = httpProxy;
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
|
||||
@@ -22,10 +22,7 @@ export default class Notice extends BaseModel {
|
||||
content: string; // 公告内容
|
||||
|
||||
@prop({ required: true })
|
||||
timeStr: string; // 时间显示
|
||||
public get time() {
|
||||
return this.timeStr;
|
||||
}
|
||||
time: string; // 时间显示
|
||||
|
||||
@prop({ required: true, select: false })
|
||||
sort: number;
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'reflect-metadata'
|
||||
import * as mongoose from 'mongoose';
|
||||
import { Application, IBoot } from 'egg';
|
||||
import { connectRedis } from './app/pubUtils/redis';
|
||||
import { loadGmDb } from '@db/index';
|
||||
|
||||
export default class FooBoot implements IBoot {
|
||||
private readonly app: Application;
|
||||
@@ -15,6 +16,7 @@ export default class FooBoot implements IBoot {
|
||||
// Config, plugin files are referred,`
|
||||
// this is the last chance to modify the config.
|
||||
await this.connectDB(this.app);
|
||||
await this.connectGMDB(this.app);
|
||||
await this.connectRedis(this.app);
|
||||
|
||||
}
|
||||
@@ -51,10 +53,29 @@ export default class FooBoot implements IBoot {
|
||||
|
||||
public async connectDB(app: Application) {
|
||||
const { url, options } = app.config.mongoose
|
||||
try {
|
||||
if (url) {
|
||||
const connection = await mongoose.connect(url, options)
|
||||
console.log('******connectDB suc', url, options)
|
||||
app.context.connection = connection
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
public async connectGMDB(app: Application) {
|
||||
const { url, options } = app.config.gmmongoose
|
||||
try {
|
||||
if (url) {
|
||||
const connection = await mongoose.createConnection(url, options)
|
||||
app.context.connectionGM = connection;
|
||||
loadGmDb(connection);
|
||||
console.log('******connectGMDB suc', url, options)
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
public async connectRedis(app: Application) {
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
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 + '_1597499383757_3508';
|
||||
config.security = {
|
||||
csrf: {
|
||||
enable: false,
|
||||
},
|
||||
domainWhiteList: [ '*' ],
|
||||
};
|
||||
config.cors = {
|
||||
origin: '*', // 匹配规则 域名+端口 *则为全匹配
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
};
|
||||
// add your egg config in here
|
||||
config.middleware = [ 'parmsDecode' ];
|
||||
|
||||
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 },
|
||||
@@ -29,51 +13,10 @@ export default (appInfo: EggAppInfo) => {
|
||||
url: 'r-8vbl8okinxn1zhkwh2.redis.zhangbei.rds.aliyuncs.com', // 内网
|
||||
pw: 'zyz_alpha_2021'
|
||||
};
|
||||
// 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.view = {
|
||||
root: path.join(appInfo.baseDir, '/app/public'),
|
||||
defaultViewEngine: 'nunjucks',
|
||||
mapping: {
|
||||
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
|
||||
},
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
prefix: '/',
|
||||
dir: path.join(appInfo.baseDir, '/app/public'),
|
||||
};
|
||||
|
||||
config.customLogger = {
|
||||
linkLogger: {
|
||||
file: path.join(appInfo.root, 'logs/web-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,
|
||||
};
|
||||
// add your special config in here
|
||||
const bizConfig = {
|
||||
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||
};
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
...config,
|
||||
...bizConfig,
|
||||
...defaultConfig(appInfo),
|
||||
...config
|
||||
};
|
||||
};
|
||||
|
||||
@@ -24,6 +24,10 @@ export default (appInfo: EggAppInfo) => {
|
||||
url: 'mongodb://dbop:zyzMon2021@dds-8vb7474e31ba7ed41.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb7474e31ba7ed42.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-505529944', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
};
|
||||
config.gmmongoose = {
|
||||
url: 'mongodb://dbop:zyzGm2021@dds-8vb9964bb4cc7f241.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb9964bb4cc7f242.mongodb.zhangbei.rds.aliyuncs.com:3717/zyzgm?replicaSet=mgset-507933150', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
};
|
||||
config.redis = {
|
||||
url: 'r-8vb130185rp2ir3lqn.redis.zhangbei.rds.aliyuncs.com', // 内网
|
||||
pw: 'zyz_monitor_2021'
|
||||
@@ -44,12 +48,6 @@ export default (appInfo: EggAppInfo) => {
|
||||
},
|
||||
};
|
||||
|
||||
exports.xtransit = {
|
||||
server: 'ws://127.0.0.1:9092',
|
||||
appId: 3,
|
||||
appSecret: 'a48ad5ca44e2d02cbd7f4c0326fa3101'
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
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 + '_1597499383757_3508';
|
||||
config.security = {
|
||||
csrf: {
|
||||
enable: false,
|
||||
},
|
||||
domainWhiteList: [ '*' ],
|
||||
};
|
||||
config.cors = {
|
||||
origin: '*', // 匹配规则 域名+端口 *则为全匹配
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
};
|
||||
// add your egg config in here
|
||||
config.middleware = [ 'parmsDecode' ];
|
||||
|
||||
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 },
|
||||
@@ -29,51 +13,9 @@ export default (appInfo: EggAppInfo) => {
|
||||
pw: 'zyz_dev_2021'
|
||||
};
|
||||
|
||||
// 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.view = {
|
||||
root: path.join(appInfo.baseDir, '/app/public'),
|
||||
defaultViewEngine: 'nunjucks',
|
||||
mapping: {
|
||||
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
|
||||
},
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
prefix: '/',
|
||||
dir: path.join(appInfo.baseDir, '/app/public'),
|
||||
};
|
||||
config.customLogger = {
|
||||
linkLogger: {
|
||||
file: path.join(appInfo.root, 'logs/web-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,
|
||||
};
|
||||
|
||||
// add your special config in here
|
||||
const bizConfig = {
|
||||
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||
};
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
...config,
|
||||
...bizConfig,
|
||||
...defaultConfig(appInfo),
|
||||
...config
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
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 + '_1597499383757_3508';
|
||||
config.security = {
|
||||
csrf: {
|
||||
enable: false,
|
||||
},
|
||||
domainWhiteList: [ '*' ],
|
||||
};
|
||||
config.cors = {
|
||||
origin: '*', // 匹配规则 域名+端口 *则为全匹配
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
};
|
||||
// add your egg config in here
|
||||
config.middleware = [ 'parmsDecode' ];
|
||||
|
||||
config.mongoose = {
|
||||
url: 'mongodb://root:Bantus123@dds-8vb74337eab84d641.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb74337eab84d642.mongodb.zhangbei.rds.aliyuncs.com:3717/admin?replicaSet=mgset-504694158', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
@@ -29,51 +13,9 @@ export default (appInfo: EggAppInfo) => {
|
||||
pw: 'zyz_isbn_2021'
|
||||
};
|
||||
|
||||
// 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.view = {
|
||||
root: path.join(appInfo.baseDir, '/app/public'),
|
||||
defaultViewEngine: 'nunjucks',
|
||||
mapping: {
|
||||
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
|
||||
},
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
prefix: '/',
|
||||
dir: path.join(appInfo.baseDir, '/app/public'),
|
||||
};
|
||||
|
||||
config.customLogger = {
|
||||
linkLogger: {
|
||||
file: path.join(appInfo.root, 'logs/web-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,
|
||||
};
|
||||
// add your special config in here
|
||||
const bizConfig = {
|
||||
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||
};
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
...config,
|
||||
...bizConfig,
|
||||
...defaultConfig(appInfo),
|
||||
...config
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,80 +1,27 @@
|
||||
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 + '_1597499383757_3508';
|
||||
config.security = {
|
||||
csrf: {
|
||||
enable: false,
|
||||
},
|
||||
domainWhiteList: [ '*' ],
|
||||
};
|
||||
config.cors = {
|
||||
origin: '*', // 匹配规则 域名+端口 *则为全匹配
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
};
|
||||
// add your egg config in here
|
||||
config.middleware = [ 'parmsDecode' ];
|
||||
|
||||
config.mongoose = {
|
||||
url: 'mongodb://127.0.0.1/zyz', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
};
|
||||
config.gmmongoose = {
|
||||
url: 'mongodb://127.0.0.1:27017/zyzgm', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
};
|
||||
config.redis = {
|
||||
url: '127.0.0.1', // 内网
|
||||
pw: ''
|
||||
};
|
||||
|
||||
// config.alinode = {
|
||||
// appid: '86043',
|
||||
// secret: '54ef0364995b0c4f2ab42150e29ad30df8327a3a',
|
||||
// error_log: [ '${appInfo.root}/logs/${appInfo.name}/zyz-web.log', '${appInfo.root}/logs/${appInfo.name}/common-error.log', '${appInfo.root}/logs/${appInfo.name}/egg-agent.log' ],
|
||||
// packages: [ '${appInfo.baseDir}/package.json' ],
|
||||
// };
|
||||
|
||||
config.view = {
|
||||
root: path.join(appInfo.baseDir, '/app/public'),
|
||||
defaultViewEngine: 'nunjucks',
|
||||
mapping: {
|
||||
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
|
||||
},
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
prefix: '/',
|
||||
dir: path.join(appInfo.baseDir, '/app/public'),
|
||||
};
|
||||
|
||||
config.customLogger = {
|
||||
linkLogger: {
|
||||
file: path.join(appInfo.root, 'logs/web-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,
|
||||
};
|
||||
|
||||
// add your special config in here
|
||||
const bizConfig = {
|
||||
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||
};
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
...defaultConfig(appInfo),
|
||||
...config,
|
||||
...bizConfig,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
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 + '_1597499383757_3508';
|
||||
config.security = {
|
||||
csrf: {
|
||||
enable: false,
|
||||
},
|
||||
domainWhiteList: [ '*' ],
|
||||
};
|
||||
config.cors = {
|
||||
origin: '*', // 匹配规则 域名+端口 *则为全匹配
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
};
|
||||
// add your egg config in here
|
||||
config.middleware = [ 'parmsDecode' ];
|
||||
|
||||
config.mongoose = {
|
||||
url: 'mongodb://dbop:zyzMon2021@dds-8vb7474e31ba7ed41.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb7474e31ba7ed42.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-505529944', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
@@ -29,57 +13,15 @@ export default (appInfo: EggAppInfo) => {
|
||||
pw: 'zyz_monitor_2021'
|
||||
};
|
||||
|
||||
// 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.view = {
|
||||
root: path.join(appInfo.baseDir, '/app/public'),
|
||||
defaultViewEngine: 'nunjucks',
|
||||
mapping: {
|
||||
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
|
||||
},
|
||||
};
|
||||
|
||||
exports.xtransit = {
|
||||
server: 'ws://127.0.0.1:9092',
|
||||
appId: 3,
|
||||
appSecret: 'a48ad5ca44e2d02cbd7f4c0326fa3101'
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
prefix: '/',
|
||||
dir: path.join(appInfo.baseDir, '/app/public'),
|
||||
};
|
||||
|
||||
config.customLogger = {
|
||||
linkLogger: {
|
||||
file: path.join(appInfo.root, 'logs/web-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,
|
||||
};
|
||||
// add your special config in here
|
||||
const bizConfig = {
|
||||
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||
};
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
...config,
|
||||
...bizConfig,
|
||||
...defaultConfig(appInfo),
|
||||
...config
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
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 + '_1597499383757_3508';
|
||||
config.security = {
|
||||
csrf: {
|
||||
enable: false,
|
||||
},
|
||||
domainWhiteList: [ '*' ],
|
||||
};
|
||||
config.cors = {
|
||||
origin: '*', // 匹配规则 域名+端口 *则为全匹配
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
};
|
||||
// add your egg config in here
|
||||
config.middleware = [ 'parmsDecode' ];
|
||||
|
||||
config.mongoose = {
|
||||
url: 'mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbdb47c6fb58a542.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-500808098', // 内网
|
||||
options: { useNewUrlParser: true, useUnifiedTopology: true },
|
||||
@@ -29,28 +13,6 @@ export default (appInfo: EggAppInfo) => {
|
||||
pw: 'zyz_2020'
|
||||
};
|
||||
|
||||
// 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.view = {
|
||||
root: path.join(appInfo.baseDir, '/app/public'),
|
||||
defaultViewEngine: 'nunjucks',
|
||||
mapping: {
|
||||
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
|
||||
},
|
||||
};
|
||||
|
||||
config.decodeParm = true;
|
||||
|
||||
config.static = {
|
||||
prefix: '/',
|
||||
dir: path.join(appInfo.baseDir, '/app/public'),
|
||||
};
|
||||
|
||||
config.xtransit = {
|
||||
server: 'ws://172.26.117.35:9092',
|
||||
appId: 3,
|
||||
@@ -58,29 +20,9 @@ export default (appInfo: EggAppInfo) => {
|
||||
error_log: [ '/root/logs/zyz/zyz-web.log', '/root/logs/zyz/common-error.log', '/root/logs/zyz/egg-agent.log' ],
|
||||
};
|
||||
|
||||
config.customLogger = {
|
||||
linkLogger: {
|
||||
file: path.join(appInfo.root, 'logs/web-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,
|
||||
};
|
||||
// add your special config in here
|
||||
const bizConfig = {
|
||||
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||
};
|
||||
|
||||
// the return config will combines to EggAppConfig
|
||||
return {
|
||||
...config,
|
||||
...bizConfig,
|
||||
...defaultConfig(appInfo),
|
||||
...config
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user