core/config/index.js

34 lines
862 B
JavaScript
Raw Normal View History

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: {},
2022-07-04 16:04:29 +08:00
spa: false, // 单路由模式, 即无论是访问路径是什么, 永远只会调用 \apps\index\index()
2020-09-15 18:35:00 +08:00
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模式
2023-11-01 18:46:47 +08:00
2020-09-22 19:58:29 +08:00
cors: {
enabled: false,
credentials: false,
origin: [], // ['abc.com', 'a.foo.com']
2020-09-30 14:25:08 +08:00
maxAge: 14400
2020-09-22 19:58:29 +08:00
},
2023-10-24 15:24:55 +08:00
// 常用正则
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}$/
}
}