123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- '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/v1/api';
- const payReturn = '/dev/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://120.48.146.1:27017/shoppingOne', // 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,
- };
- };
|