Merge pull request #1415 from hackmdio/bugfix/enable-version-check-only-in-production

Enable version check only in NODE_ENV production
This commit is contained in:
Raccoon 2020-02-25 14:28:53 +08:00 committed by GitHub
commit 05dd6eb739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
} }