From ebbbcf8b773cadd2954fb8c6de2db02b42ee15e0 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 30 Aug 2023 14:51:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Config.md diff --git a/Config.md b/Config.md new file mode 100644 index 0000000..cd34580 --- /dev/null +++ b/Config.md @@ -0,0 +1,66 @@ +```js +{ + db: {}, + session: { + enabled: false, + type: 'native', // native 或 redis + ttl: 3600 * 24 * 7, + domain: '', // NODESSID域, 默认等于domain + level: 0, // 校验级别, 0: 不校验客户端, 2: ua, 4: ip, 6: ua + ip + db: { + host: '127.0.0.1', + port: 6379, + db: 0 + } + }, + jwt: { + // jwt 开关 + enabled: false, + ttl: 3600 * 24 * 7, + level: 0, // 校验级别, 0: 不校验客户端, 2: ua, 4: ip, 6: ua + ip + secret: 'it_is_secret_key' // jwt密钥, 使用时请修改 + }, + website: 'localhost', + domain: '', // cookie域, 默认等于website + port: 3000, + env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV, + debug: process.env.NODE_ENV === ENV_DEV, // debug模式 + smtp: { + host: 'smtp.example.com', + port: 25, + mail: 'no-reply@example.com', + name: 'no-reply', + passwd: '' + }, + views: { + enabled: false, + dir: '', + ext: '.htm' + }, + cors: { + enabled: false, + credentials: false, + origin: [], // ['abc.com', 'a.foo.com'] + maxAge: 14400 + }, + regexp: { + // 常用正则 + email: /^[\w\.\-]+@\w+([\.\-]\w+)*\.\w+$/, + uname: /^[A-Za-z\d_]{4,16}$/, + passwd: /^\S{6,20}$/, + phone: /^1[3456789]\d{9}$/, + 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)$/, + cn: /^[\u4e00-\u9fa5]+$/, + qq: /^\d{5,12}$/ + } +} +``` + + + +---- + +上一节: [⟪入口文件配置⟫](https://github.com/bytedo/gmf.core/wiki/Entry) + +下一节: [⟪路由⟫](https://github.com/bytedo/gmf.core/wiki/Router) +