2020-09-15 18:35:00 +08:00
|
|
|
/**
|
2020-09-22 19:58:29 +08:00
|
|
|
* 部分配置
|
|
|
|
* @author yutent<yutent.io@gmail.com>
|
|
|
|
* @date 2020/09/22 17:19:39
|
2020-09-15 18:35:00 +08:00
|
|
|
*/
|
|
|
|
|
2020-09-22 19:58:29 +08:00
|
|
|
const ENV_PROD = 'production'
|
|
|
|
const ENV_DEV = 'development'
|
2020-09-15 18:35:00 +08:00
|
|
|
|
2020-09-16 14:08:06 +08:00
|
|
|
export default {
|
2020-09-15 18:35:00 +08:00
|
|
|
db: {},
|
|
|
|
session: {
|
2020-09-25 18:34:04 +08:00
|
|
|
enabled: false,
|
2020-09-15 18:35:00 +08:00
|
|
|
ttl: 3600 * 24 * 7,
|
|
|
|
domain: '', // NODESSID域, 默认等于domain
|
2020-09-24 19:57:47 +08:00
|
|
|
level: 0, // 校验级别, 0: 不校验客户端, 2: ua, 4: ip, 6: ua + ip
|
2020-09-15 18:35:00 +08:00
|
|
|
db: {
|
|
|
|
host: '127.0.0.1',
|
|
|
|
port: 6379,
|
|
|
|
db: 0
|
|
|
|
}
|
|
|
|
},
|
2020-09-25 18:34:04 +08:00
|
|
|
jwt: {
|
|
|
|
// jwt 开关
|
|
|
|
enabled: false,
|
|
|
|
ttl: 3600 * 24 * 7,
|
|
|
|
level: 0, // 校验级别, 0: 不校验客户端, 2: ua, 4: ip, 6: ua + ip
|
|
|
|
secret: 'it_is_secret_key' // jwt密钥, 使用时请修改
|
|
|
|
},
|
2020-09-15 18:35:00 +08:00
|
|
|
website: 'localhost',
|
|
|
|
domain: '', // cookie域, 默认等于website
|
|
|
|
port: 3000,
|
2020-09-22 19:58:29 +08:00
|
|
|
env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV,
|
|
|
|
debug: process.env.NODE_ENV === ENV_DEV, // debug模式
|
2020-09-15 18:35:00 +08:00
|
|
|
smtp: {
|
|
|
|
host: 'smtp.example.com',
|
|
|
|
port: 25,
|
2020-09-22 19:58:29 +08:00
|
|
|
mail: 'no-reply@example.com',
|
|
|
|
name: 'no-reply',
|
2020-09-15 18:35:00 +08:00
|
|
|
passwd: ''
|
|
|
|
},
|
2020-09-27 19:40:09 +08:00
|
|
|
views: {
|
|
|
|
enabled: true,
|
|
|
|
dir: '',
|
|
|
|
ext: '.htm'
|
|
|
|
},
|
2020-09-22 19:58:29 +08:00
|
|
|
cors: {
|
|
|
|
enabled: false,
|
|
|
|
credentials: false,
|
|
|
|
origin: [], // ['abc.com', 'a.foo.com']
|
|
|
|
maxAge: 0
|
|
|
|
},
|
2020-09-15 18:35:00 +08:00
|
|
|
regexp: {
|
|
|
|
// 常用正则
|
|
|
|
email: /^[\w\.\-]+@\w+([\.\-]\w+)*\.\w+$/,
|
|
|
|
uname: /^[A-Za-z\d_]{4,16}$/,
|
2020-09-22 19:58:29 +08:00
|
|
|
passwd: /^\S{6,20}$/,
|
|
|
|
phone: /^1[3456789]\d{9}$/,
|
2020-09-15 18:35:00 +08:00
|
|
|
idCard: /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X|x)$/,
|
2020-09-22 19:58:29 +08:00
|
|
|
cn: /^[\u4e00-\u9fa5]+$/,
|
2020-09-15 18:35:00 +08:00
|
|
|
qq: /^\d{5,12}$/
|
|
|
|
}
|
|
|
|
}
|