1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- /* 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 = [ 'checkToken', 'requestLog' ];
- // add your user config here
- const userConfig = {
- // myAppName: 'egg',
- };
- // 日志
- config.logger = {
- level: 'DEBUG',
- allowDebugAtProd: true,
- };
- // mq设置
- config.amqp = {
- client: {
- hostname: '127.0.0.1',
- username: 'freeAdmin',
- password: '1qaz2wsx',
- vhost: 'freeAdmin',
- },
- app: true,
- agent: true,
- };
- // 接收队列名称
- config.queue = 'freeAdmin/server-user';
- // 发送队列名称
- config.sendQueue = {
- logs: 'freeAdmin/server-logs',
- };
- // 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: 'freeAdmin',
- };
- // 数据库设置
- config.dbName = 'freeAdmin';
- config.mongoose = {
- url: `mongodb://localhost:27017/${config.dbName}`,
- options: {
- user: 'admin',
- pass: 'admin',
- authSource: 'admin',
- useNewUrlParser: true,
- useCreateIndex: true,
- },
- };
- // 路由设置
- config.routePrefix = '/freeAdmin/api';
- // 中间件
- config.requestLog = {
- toMongoDB: true,
- };
- config.module = 'user';
- return {
- ...config,
- ...userConfig,
- };
- };
|