config.default.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. 'use strict';
  2. const path = require('path');
  3. const operatorsAliases = require('../config/config.sequelize');
  4. module.exports = appInfo => {
  5. const config = {};
  6. // should change to your own
  7. config.keys = appInfo.name + '_1503910405503_882';
  8. config.sequelize = {
  9. dialect: 'mysql',
  10. host: '192.168.1.170',
  11. port: 30000,
  12. database: 'construction',
  13. username: "caipin",
  14. password: "123456",
  15. define: {
  16. freezeTableName: true,
  17. timestamps: true,
  18. updatedAt: false,
  19. createdAt: false
  20. },
  21. operatorsAliases:operatorsAliases.operatorsAliases
  22. };
  23. // 数据库配置
  24. // config.mysql = {
  25. // client: {
  26. // // host
  27. // host: 'rm-wz9ae9t6qopwrday6.mysql.rds.aliyuncs.com',
  28. // // 端口号
  29. // port: '3306',
  30. // // 用户名
  31. // user: 'zh_calc',
  32. // // 密码
  33. // password: 'Zh@)!(3850Calc',
  34. // // 数据库名
  35. // database: 'calculation',
  36. // },
  37. // // 是否加载到 app 上,默认开启
  38. // app: true,
  39. // // 是否加载到 agent 上,默认关闭
  40. // agent: false,
  41. // };
  42. // 表名前缀
  43. config.tablePrefix = 'cm_';
  44. // redis设置
  45. config.redis = {
  46. client: {
  47. host: '127.0.0.1',
  48. port: '6379',
  49. password: 'zh@)!(3850sc',
  50. db: '0',
  51. },
  52. agent: true,
  53. };
  54. // view相关
  55. config.view = {
  56. mapping: {
  57. '.ejs': 'ejs',
  58. },
  59. root: [
  60. path.join(appInfo.baseDir, 'app/view'),
  61. ].join(','),
  62. };
  63. // 分页相关
  64. config.pageSize = 15;
  65. // 中间件
  66. config.middleware = ['urlParse', 'sortFilter', 'autoLogger'];
  67. // session配置
  68. config.session = {
  69. key: 'ZH_SESS',
  70. maxAge: 4 * 3600 * 1000, // 4小时
  71. httpOnly: true,
  72. encrypt: true,
  73. };
  74. // session使用redis
  75. exports.sessionRedis = {
  76. name: 'session',
  77. };
  78. // 缓存时间
  79. config.cacheTime = 1800;
  80. // 安全性配置
  81. config.security = {
  82. csrf: {
  83. ignoreJSON: false, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  84. },
  85. };
  86. // 上传设置
  87. config.multipart = {
  88. whitelist: ['.xls', '.xlsx', '.json',
  89. '.png', '.jpg', '.jpeg', '.gif', '.bmp'],
  90. fileSize: '10mb',
  91. };
  92. // 发送短信相关
  93. config.sms = {
  94. // account: '710030',
  95. // password: 'w7pRhJ',
  96. // extno: '10690587',
  97. authKey: 'fb5ef483e44b9556512a9febef376051',
  98. };
  99. // geetest验证码key
  100. config.geetest = {
  101. id: '23c50f6711966f744c93a70167c8e0a4',
  102. key: '9b67989994f9def437ea68bb495f0162',
  103. };
  104. config.filePath = '/etc/calc/files/';
  105. // 前端验证
  106. config.jsValidator = {
  107. client: {},
  108. app: true,
  109. };
  110. config.min = true;
  111. config.static = {
  112. maxAge: 0,
  113. buffer: false,
  114. };
  115. config.customLogger = {
  116. // 操作失败日志
  117. fail: {
  118. file: path.join(appInfo.root, 'logs', appInfo.name, 'fail.log'),
  119. },
  120. };
  121. return config;
  122. };