'use strict'; // 生产配置 /** * @param {Egg.EggAppInfo} appInfo app info */ const ip = 'host.docker.internal'; const dbName = 'shoppingOne'; const redisPwd = '123456'; const redisDB = 2; const mqUser = 'shoppingOne'; const routePrefix = '/point/one/v1/api'; const payReturn = 'https://broadcast.waityou24.cn/point/one/v1/api/pay/order'; const email_smsConfig = 'shoppingOne'; const appSign = 'shoppingOne'; 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 + '_1664237342649_2194'; config.appName = '商城-服务'; // add your middleware config here config.middleware = [ 'errorEmail', 'setUserFromToken', 'checkLogin', 'checkUserRK' ]; // , 'checkLogin' // add your user config here const userConfig = { // myAppName: 'egg', }; config.checkToken = { enable: false, }; // 进程设置 config.cluster = { listen: { port: 12211, }, }; // 数据库设置 config.mongoose = { url: `mongodb://${ip}:27017/${dbName}`, // 120.48.146.1 127.0.0.1 options: { user: 'admin', pass: 'admin', authSource: 'admin', useNewUrlParser: true, useCreateIndex: true, useFindAndModify: true, allowDiskUse: true, }, }; // jwt设置 config.jwt = { ...jwt, expiresIn: '1d', issuer: 'shopping', }; // redis设置 config.redis = { client: { port: 6379, // Redis port host: ip, // Redis host password: redisPwd, db: redisDB, }, }; // mq设置 config.amqp = { client: { hostname: ip, username: mqUser, password: mqUser, vhost: mqUser, }, app: true, agent: true, }; // 定时任务机制设置 config.taskMqConfig = { ex: 'task', queue: 'task', routingKey: 'tr', deadEx: 'deadTask', deadQueue: 'deadTaskQueue', deadLetterRoutingKey: 'deadTr', }; config.msgEx = 't_m'; // 路由设置 config.routePrefix = routePrefix; // 支付路由回调设置 config.payReturn = { order: payReturn, }; // http请求前缀 config.httpPrefix = { wechat: 'https://broadcast.waityou24.cn/wechat/api', email: 'http://127.0.0.1:14002/semail/api', sms: 'http://127.0.0.1:14003/sms/api', }; config.emailConfig = { config: email_smsConfig, }; config.smsConfig = { config: email_smsConfig, }; // 中间件 config.requestLog = { toMongoDB: true, }; config.redisKey = { orderKeyPrefix: 'orderKey:', }; config.redisTimeout = 3600; config.errcode = { groupJoinRefund: -111, }; config.wxPayConfig = appSign; config.logger = { level: 'NONE', }; config.projects = [ 'group-service', 'service-point_shop' ]; // 协作项目:团购服务,尊荣服务 return { ...config, ...userConfig, }; };