/* eslint valid-jsdoc: "off" */ 'use strict'; /** * @param {Egg.EggAppInfo} appInfo app info */ const ip = '192.168.1.197'; const dbName = 'shoppingOne-dev'; const redisPwd = ''; const redisDB = 3; const mqUser = 'shoppingOneDev'; const routePrefix = '/dev/point/one/zr/v1/api'; const email_smsConfig = 'shoppingOne'; const appSign = 'shoppingOneApp'; 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 + '_1666686710616_3993'; config.appName = '商城-服务'; // add your middleware config here config.middleware = [ 'setUserFromToken' ]; config.checkToken = { enable: false, }; // 进程设置 config.cluster = { listen: { port: 12212, }, }; // 数据库设置 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, }, }; // 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, }; // jwt设置 config.jwt = { ...jwt, expiresIn: '1d', issuer: 'shopping', }; // 路由设置 config.routePrefix = routePrefix; config.emailConfig = { config: email_smsConfig, }; config.smsConfig = { config: email_smsConfig, }; // 中间件 config.requestLog = { toMongoDB: true, }; config.redisKey = { orderKeyPrefix: 'zrOrderKey:', }; config.redisTimeout = 3600; config.wxPayConfig = appSign; // add your user config here const userConfig = { // myAppName: 'egg', }; return { ...config, ...userConfig, }; };