lrf 1 year ago
parent
commit
c9c4dc12d4
3 changed files with 99 additions and 33 deletions
  1. 1 0
      .eslintignore
  2. 22 15
      config/config.default.js
  3. 76 18
      config/config.prod.js

+ 1 - 0
.eslintignore

@@ -1 +1,2 @@
 coverage
+config/config.local.js

+ 22 - 15
config/config.default.js

@@ -5,6 +5,14 @@
 /**
  * @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 => {
   /**
@@ -15,7 +23,7 @@ module.exports = appInfo => {
 
   // use for cookie sign key, should change to your own and keep security
   config.keys = appInfo.name + '_1666686710616_3993';
-  config.appName = '天恩活泉商城-服务';
+  config.appName = '商城-服务';
 
   // add your middleware config here
   config.middleware = [ 'setUserFromToken' ];
@@ -25,13 +33,12 @@ module.exports = appInfo => {
   // 进程设置
   config.cluster = {
     listen: {
-      port: 12112,
+      port: 12212,
     },
   };
   // 数据库设置
-  config.dbName = 'point_shopping';
   config.mongoose = {
-    url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
+    url: `mongodb://${ip}:27017/${dbName}`, // 120.48.146.1 127.0.0.1
     options: {
       user: 'admin',
       pass: 'admin',
@@ -46,18 +53,18 @@ module.exports = appInfo => {
   config.redis = {
     client: {
       port: 6379, // Redis port
-      host: '127.0.0.1', // Redis host
-      password: '123456',
-      db: 1,
+      host: ip, // Redis host
+      password: redisPwd,
+      db: redisDB,
     },
   };
   // mq设置
   config.amqp = {
     client: {
-      hostname: 'broadcast.waityou24.cn',
-      username: 'tehqDev',
-      password: 'tehqDev',
-      vhost: 'tehqDev',
+      hostname: ip,
+      username: mqUser,
+      password: mqUser,
+      vhost: mqUser,
     },
     app: true,
     agent: true,
@@ -69,12 +76,12 @@ module.exports = appInfo => {
     issuer: 'shopping',
   };
   // 路由设置
-  config.routePrefix = '/point/zr/v1/api';
+  config.routePrefix = routePrefix;
   config.emailConfig = {
-    config: 'free',
+    config: email_smsConfig,
   };
   config.smsConfig = {
-    config: 'free',
+    config: email_smsConfig,
   };
   // 中间件
   config.requestLog = {
@@ -85,7 +92,7 @@ module.exports = appInfo => {
     orderKeyPrefix: 'zrOrderKey:',
   };
   config.redisTimeout = 3600;
-  config.wxPayConfig = 'pointApp';
+  config.wxPayConfig = appSign;
   // add your user config here
   const userConfig = {
     // myAppName: 'egg',

+ 76 - 18
config/config.prod.js

@@ -1,10 +1,44 @@
+/* eslint valid-jsdoc: "off" */
+
 'use strict';
-module.exports = appInfo => {
+
+/**
+ * @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/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.dbName = 'point_shopping';
   config.mongoose = {
-    url: `mongodb://127.0.0.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
+    url: `mongodb://${ip}:27017/${dbName}`, // 120.48.146.1 127.0.0.1
     options: {
       user: 'admin',
       pass: 'admin',
@@ -12,36 +46,60 @@ module.exports = appInfo => {
       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: '127.0.0.1',
-      username: 'tehq',
-      password: 'tehq',
-      vhost: 'tehq',
+      hostname: ip,
+      username: mqUser,
+      password: mqUser,
+      vhost: mqUser,
     },
     app: true,
     agent: true,
   };
-  // redis设置
-  config.redis = {
-    client: {
-      port: 6379, // Redis port
-      host: '127.0.0.1', // Redis host
-      password: '123456',
-      db: 1,
-    },
+  // jwt设置
+  config.jwt = {
+    ...jwt,
+    expiresIn: '1d',
+    issuer: 'shopping',
   };
+  // 路由设置
+  config.routePrefix = routePrefix;
   config.emailConfig = {
-    config: 'tehq',
+    config: email_smsConfig,
   };
   config.smsConfig = {
-    config: 'tehq',
+    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',
   };
-  config.wxPayConfig = 'tehqApp';
+
   return {
     ...config,
+    ...userConfig,
   };
 };