123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /* eslint valid-jsdoc: "off" */
- 'use strict';
- /**
- * @param {Egg.EggAppInfo} appInfo app info
- */
- const { jwt } = require('./config.secret');
- module.exports = appInfo => {
- /**
- * built-in config
- * @type {Egg.EggAppConfig}
- **/
- const config = (exports = {});
- // use for cookie sign key, should change to your own and keep security
- config.keys = appInfo.name + '_1640765284662_2781';
- // add your middleware config here
- config.middleware = [ 'turnResponse' ];
- // add your user config here
- const userConfig = {
- // myAppName: 'egg',
- };
- // 日志
- config.logger = {
- level: 'DEBUG',
- allowDebugAtProd: true,
- };
- // 发送队列名称
- // config.sendQueue = {
- // logs: 'freeAdmin/server-logs',
- // };
- // http请求前缀
- config.httpPrefix = {
- logs: 'http://localhost:13002/freeAdminLog/api',
- };
- // redis设置
- // config.redis = {
- // client: {
- // port: 6379, // Redis port
- // host: '127.0.0.1', // Redis host
- // password: '123456',
- // db: 0,
- // },
- // };
- // 进程设置
- config.cluster = {
- listen: {
- port: 13001,
- },
- };
- // jwt设置
- config.jwt = {
- ...jwt,
- expiresIn: '1d',
- issuer: 'lab',
- };
- // 数据库设置
- config.dbName = 'label-achievement';
- config.mongoose = {
- url: `mongodb://localhost:27017/${config.dbName}`,
- options: {
- user: 'admin',
- pass: 'admin',
- authSource: 'admin',
- useNewUrlParser: true,
- useCreateIndex: true,
- },
- };
- // mysql
- config.mysql = {
- client: {
- // host
- host: 'localhost',
- // 端口号
- port: '3307',
- // 用户名
- user: 'root',
- // 密码
- password: 'root',
- // 数据库名
- database: 'management_platform',
- },
- // 是否加载到 app 上,默认开启
- app: true,
- // 是否加载到 agent 上,默认关闭
- agent: false,
- };
- // 路由设置
- config.routePrefix = '/labelAchievement/api';
- // 中间件
- config.requestLog = {
- toMongoDB: true,
- };
- return {
- ...config,
- ...userConfig,
- };
- };
|