Enable version check only in NODE_ENV production

Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
Yukai Huang 2020-02-25 14:06:46 +08:00
parent f09b317e63
commit 59f177d891
No known key found for this signature in database
GPG Key ID: D4D3B2F0E99D4914
1 changed files with 2 additions and 1 deletions

3
app.js
View File

@ -24,6 +24,7 @@ var logger = require('./lib/logger')
var response = require('./lib/response') var response = require('./lib/response')
var models = require('./lib/models') var models = require('./lib/models')
var csp = require('./lib/csp') var csp = require('./lib/csp')
const { Environment } = require('./lib/config/enum')
const { versionCheckMiddleware, checkVersion } = require('./lib/web/middleware/checkVersion') const { versionCheckMiddleware, checkVersion } = require('./lib/web/middleware/checkVersion')
@ -169,7 +170,7 @@ app.use(require('./lib/middleware/checkURIValid'))
app.use(require('./lib/middleware/redirectWithoutTrailingSlashes')) app.use(require('./lib/middleware/redirectWithoutTrailingSlashes'))
app.use(require('./lib/middleware/codiMDVersion')) app.use(require('./lib/middleware/codiMDVersion'))
if (config.autoVersionCheck) { if (config.autoVersionCheck && process.env.NODE_ENV === Environment.production) {
checkVersion(app) checkVersion(app)
app.use(versionCheckMiddleware) app.use(versionCheckMiddleware)
} }