123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- 'use strict';
- const path = require('path');
- const operatorsAliases = require('../config/config.sequelize');
- module.exports = appInfo => {
- const config = {};
- // should change to your own
- config.keys = appInfo.name + '_1503910405503_882';
- config.sequelize = {
- dialect: 'mysql',
- host: '192.168.1.170',
- port: 30000,
- database: 'construction',
- username: "caipin",
- password: "123456",
- define: {
- freezeTableName: true,
- timestamps: true,
- updatedAt: false,
- createdAt: false
- },
- operatorsAliases:operatorsAliases.operatorsAliases
- };
- // 数据库配置
- // config.mysql = {
- // client: {
- // // host
- // host: 'rm-wz9ae9t6qopwrday6.mysql.rds.aliyuncs.com',
- // // 端口号
- // port: '3306',
- // // 用户名
- // user: 'zh_calc',
- // // 密码
- // password: 'Zh@)!(3850Calc',
- // // 数据库名
- // database: 'calculation',
- // },
- // // 是否加载到 app 上,默认开启
- // app: true,
- // // 是否加载到 agent 上,默认关闭
- // agent: false,
- // };
- // 表名前缀
- config.tablePrefix = 'cm_';
- // redis设置
- config.redis = {
- client: {
- host: '127.0.0.1',
- port: '6379',
- password: 'zh@)!(3850sc',
- db: '0',
- },
- agent: true,
- };
- // view相关
- config.view = {
- mapping: {
- '.ejs': 'ejs',
- },
- root: [
- path.join(appInfo.baseDir, 'app/view'),
- ].join(','),
- };
- // 分页相关
- config.pageSize = 15;
- // 中间件
- config.middleware = ['urlParse', 'sortFilter', 'autoLogger'];
- // session配置
- config.session = {
- key: 'ZH_SESS',
- maxAge: 4 * 3600 * 1000, // 4小时
- httpOnly: true,
- encrypt: true,
- };
- // session使用redis
- exports.sessionRedis = {
- name: 'session',
- };
- // 缓存时间
- config.cacheTime = 1800;
- // 安全性配置
- config.security = {
- csrf: {
- ignoreJSON: false, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
- },
- };
- // 上传设置
- config.multipart = {
- whitelist: ['.xls', '.xlsx', '.json',
- '.png', '.jpg', '.jpeg', '.gif', '.bmp'],
- fileSize: '10mb',
- };
- // 发送短信相关
- config.sms = {
- // account: '710030',
- // password: 'w7pRhJ',
- // extno: '10690587',
- authKey: 'fb5ef483e44b9556512a9febef376051',
- };
- // geetest验证码key
- config.geetest = {
- id: '23c50f6711966f744c93a70167c8e0a4',
- key: '9b67989994f9def437ea68bb495f0162',
- };
- config.filePath = '/etc/calc/files/';
- // 前端验证
- config.jsValidator = {
- client: {},
- app: true,
- };
- config.min = true;
- config.static = {
- maxAge: 0,
- buffer: false,
- };
- config.customLogger = {
- // 操作失败日志
- fail: {
- file: path.join(appInfo.root, 'logs', appInfo.name, 'fail.log'),
- },
- };
- return config;
- };
|