lrf 1 年間 前
コミット
68697c8054
4 ファイル変更142 行追加302 行削除
  1. 37 28
      config/config.default.js
  2. 0 128
      config/config.local.js
  3. 105 22
      config/config.prod.js
  4. 0 124
      config/config.prodDev.js

+ 37 - 28
config/config.default.js

@@ -1,11 +1,23 @@
 'use strict';
-// 默认配置-服务器
+// 默认配置
 
 /**
  * @param {Egg.EggAppInfo} appInfo app info
  */
+const ip = '192.168.1.197';
+const branch = 'Two';
+const branchRouter = 'two';
+const port = 12311;
+const dbName = `shopping${branch}`;
+const redisPwd = '';
+const redisDB = 3;
+const mqUser = `shopping${branch}`;
+const routePrefix = `/dev/point/${branchRouter}/v1/api`;
+const payReturn = `/dev/point/${branchRouter}/v1/api/pay/order`;
+const email_smsConfig = `shopping${branch}`;
+const appSign = `shopping${branch}`;
 const { jwt } = require('./config.secret');
-module.exports = appInfo => {
+module.exports = (appInfo) => {
   /**
    * built-in config
    * @type {Egg.EggAppConfig}
@@ -14,9 +26,9 @@ module.exports = appInfo => {
 
   // use for cookie sign key, should change to your own and keep security
   config.keys = appInfo.name + '_1664237342649_2194';
-  config.appName = '天恩活泉商城-服务';
+  config.appName = '商城-服务';
   // add your middleware config here
-  config.middleware = [ 'errorEmail', 'setUserFromToken', 'checkLogin', 'checkUserRK' ]; // , 'checkLogin'
+  config.middleware = ['errorEmail', 'setUserFromToken', 'checkLogin', 'checkUserRK']; // , 'checkLogin'
 
   // add your user config here
   const userConfig = {
@@ -28,13 +40,12 @@ module.exports = appInfo => {
   // 进程设置
   config.cluster = {
     listen: {
-      port: 12111,
+      port: port,
     },
   };
   // 数据库设置
-  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://120.48.146.1:27017/${dbName}`, // 120.48.146.1 127.0.0.1
     options: {
       user: 'admin',
       pass: 'admin',
@@ -56,53 +67,51 @@ 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: '127.0.0.1',
-      username: 'tehq',
-      password: 'tehq',
-      vhost: 'tehq',
+      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',
+    ex: `task${branch}`,
+    queue: `task${branch}`,
+    routingKey: `tr${branch}`,
+    deadEx: `deadTask${branch}`,
+    deadQueue: `deadTaskQueue${branch}`,
+    deadLetterRoutingKey: `deadTr${branch}`,
   };
   config.msgEx = 't_m';
 
   // 路由设置
-  config.routePrefix = '/point/v1/api';
+  config.routePrefix = routePrefix;
   // 支付路由回调设置
   config.payReturn = {
-    order: '/point/v1/api/pay/order',
+    order: payReturn,
   };
 
   // http请求前缀
   config.httpPrefix = {
-    // wechat: 'http://127.0.0.1:14001/wechat/api',
     wechat: 'https://broadcast.waityou24.cn/wechat/api',
-    // email: 'http://broadcast.waityou24.cn/semail/api',
     email: 'http://127.0.0.1:14002/semail/api',
     sms: 'http://127.0.0.1:14003/sms/api',
   };
   config.emailConfig = {
-    config: 'tehq',
+    config: email_smsConfig,
   };
   config.smsConfig = {
-    config: 'tehq',
+    config: email_smsConfig,
   };
   // 中间件
   config.requestLog = {
@@ -116,11 +125,11 @@ module.exports = appInfo => {
   config.errcode = {
     groupJoinRefund: -111,
   };
-  config.wxPayConfig = 'tehqApp';
+  config.wxPayConfig = appSign;
   config.logger = {
     level: 'NONE',
   };
-  config.projects = [ 'group-service', 'service-point_shop' ]; // 协作项目:团购服务,尊荣服务
+  config.projects = ['group-service', 'service-point_shop']; // 协作项目:团购服务,尊荣服务
   return {
     ...config,
     ...userConfig,

+ 0 - 128
config/config.local.js

@@ -1,128 +0,0 @@
-/* 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 + '_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.dbName = 'point_shopping-dev';
-  config.mongoose = {
-    url: `mongodb://120.48.146.1:27017/${config.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: '120.48.146.1', // Redis host
-      password: '123456',
-      db: 2,
-    },
-  };
-  // mq设置
-  config.amqp = {
-    client: {
-      hostname: '120.48.146.1',
-      username: 'tehqDev',
-      password: 'tehqDev',
-      vhost: 'tehqDev',
-    },
-    app: true,
-    agent: true,
-  };
-  // 定时任务机制设置
-  config.taskMqConfig = {
-    ex: 'taskDevLocal',
-    queue: 'taskDevLocal',
-    routingKey: 'trDevLocal',
-    deadEx: 'deadTaskDevLocal',
-    deadQueue: 'deadTaskQueueDevLocal',
-    deadLetterRoutingKey: 'deadTrDevLocal',
-  };
-
-  config.msgEx = 't_m_dev_local';
-
-
-  // 路由设置
-  config.routePrefix = '/dev/point/v1/api';
-  // 支付路由回调设置
-  config.payReturn = {
-    order: '/dev/point/v1/api/pay/order',
-  };
-
-  // http请求前缀
-  config.httpPrefix = {
-    // wechat: 'http://127.0.0.1:14001/wechat/api',
-    wechat: 'https://broadcast.waityou24.cn/wechat/api',
-    // email: 'http://broadcast.waityou24.cn/semail/api',
-    email: 'http://127.0.0.1:14002/semail/api',
-    sms: 'http://127.0.0.1:14003/sms/api',
-    chat: 'http://127.0.0.1:12214/dev/point/chat/v1/api',
-  };
-  config.emailConfig = {
-    config: 'free',
-  };
-  config.smsConfig = {
-    config: 'free',
-  };
-  // 中间件
-  config.requestLog = {
-    toMongoDB: true,
-  };
-
-  config.redisKey = {
-    orderKeyPrefix: 'orderKey:',
-  };
-  config.redisTimeout = 3600;
-  config.errcode = {
-    groupJoinRefund: -111,
-  };
-  config.wxPayConfig = 'pointApp';
-  return {
-    ...config,
-    ...userConfig,
-  };
-};

+ 105 - 22
config/config.prod.js

@@ -1,54 +1,137 @@
-"use strict";
-// 开发服务-生产环境
+'use strict';
+// 生产配置
+
+/**
+ * @param {Egg.EggAppInfo} appInfo app info
+ */
+const ip = 'host.docker.internal';
+const branch = 'Two';
+const branchRouter = 'two';
+const port = 12311;
+const dbName = `shopping${branch}`;
+const redisPwd = '123456';
+const redisDB = 3;
+const mqUser = `shopping${branch}`;
+const routePrefix = `/point/${branchRouter}/v1/api`;
+const payReturn = `https://broadcast.waityou24.cn/point/${branchRouter}/v1/api/pay/order`;
+const email_smsConfig = `shopping${branch}`;
+const appSign = `shopping${branch}`;
+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: port,
+    },
+  };
   // 数据库设置
-  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",
-      authSource: "admin",
+      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: "127.0.0.1", // Redis host
-      password: "123456",
-      db: 1,
+      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,
   };
   // 定时任务机制设置
   config.taskMqConfig = {
-    ex: "task",
-    queue: "task",
-    routingKey: "tr",
-    deadEx: "deadTask",
-    deadQueue: "deadTaskQueue",
-    deadLetterRoutingKey: "deadTr",
+    ex: `task${branch}`,
+    queue: `task${branch}`,
+    routingKey: `tr${branch}`,
+    deadEx: `deadTask${branch}`,
+    deadQueue: `deadTaskQueue${branch}`,
+    deadLetterRoutingKey: `deadTr${branch}`,
   };
-  config.logger = {
-    level: "NONE",
+  config.msgEx = `t_m_${branch}`;
+
+  // 路由设置
+  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,
   };
 };

+ 0 - 124
config/config.prodDev.js

@@ -1,124 +0,0 @@
-/* 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 + '_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.dbName = 'point_shopping-dev';
-  config.mongoose = {
-    url: `mongodb://127.0.0.1:27017/${config.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: '127.0.0.1', // Redis host
-      password: '123456',
-      db: 2,
-    },
-  };
-  // mq设置
-  config.amqp = {
-    client: {
-      hostname: '127.0.0.1',
-      username: 'tehqDev',
-      password: 'tehqDev',
-      vhost: 'tehqDev',
-    },
-    app: true,
-    agent: true,
-  };
-  // 定时任务机制设置
-  config.taskMqConfig = {
-    ex: 'taskDev',
-    queue: 'taskDev',
-    routingKey: 'trDev',
-    deadEx: 'deadTaskDev',
-    deadQueue: 'deadTaskQueueDev',
-    deadLetterRoutingKey: 'deadTrDev',
-  };
-
-  // 路由设置
-  config.routePrefix = '/dev/point/v1/api';
-  // 支付路由回调设置
-  config.payReturn = {
-    order: '/dev/point/v1/api/pay/order',
-  };
-
-  // http请求前缀
-  config.httpPrefix = {
-    // wechat: 'http://127.0.0.1:14001/wechat/api',
-    wechat: 'https://broadcast.waityou24.cn/wechat/api',
-    // email: 'http://broadcast.waityou24.cn/semail/api',
-    email: 'http://127.0.0.1:14002/semail/api',
-    sms: 'http://127.0.0.1:14003/sms/api',
-  };
-  config.emailConfig = {
-    config: 'free',
-  };
-  config.smsConfig = {
-    config: 'free',
-  };
-  // 中间件
-  config.requestLog = {
-    toMongoDB: true,
-  };
-
-  config.redisKey = {
-    orderKeyPrefix: 'orderKey:',
-  };
-  config.redisTimeout = 3600;
-  config.errcode = {
-    groupJoinRefund: -111,
-  };
-  config.wxPayConfig = 'pointApp';
-  return {
-    ...config,
-    ...userConfig,
-  };
-};