fix npm run test

This commit is contained in:
DIYgod
2018-11-02 00:00:05 +08:00
parent feb6f8471a
commit aed1dead13
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -2,6 +2,7 @@ module.exports = {
connect: {
port: process.env.PORT || 1200, // 监听端口
socket: process.env.SOCKET || null, // 监听 Unix Socket, null 为禁用
disabled: process.env.CONNECT_DISABLED, // 禁用监听,测试用
},
cacheType: process.env.CACHE_TYPE || 'memory', // 缓存类型,支持 'memory' 和 'redis',设为空可以禁止缓存
cacheExpire: process.env.CACHE_EXPIRE || 5 * 60, // 缓存时间,单位为秒
+3
View File
@@ -109,6 +109,9 @@ app.use(mount('/protected', protected_router.routes())).use(protected_router.all
app.use(mount('/api', api_router.routes())).use(api_router.allowedMethods());
// connect
if (config.connect.disabled) {
process.exit();
}
if (config.connect.port) {
app.listen(config.connect.port, parseInt(config.listenInaddrAny) ? null : '127.0.0.1');
logger.info('Listening Port ' + config.connect.port);
+1 -1
View File
@@ -10,7 +10,7 @@
"docs:build": "vuepress build docs",
"format": "eslint \"**/*.js\" --fix && prettier \"**/*.{js,json,md}\" --write",
"lint": "eslint \"**/*.js\" && prettier-check \"**/*.{js,json,md}\"",
"test": "npm run lint && timeout 5 node index.js"
"test": "npm run lint && CONNECT_DISABLED=1 node index.js"
},
"repository": {
"type": "git",