mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 00:16:21 +00:00
style: dev mode messages
This commit is contained in:
parent
1c0fd26496
commit
d878d161c0
12
lolisafe.js
12
lolisafe.js
@ -51,6 +51,7 @@ const nojs = require('./routes/nojs')
|
|||||||
const player = require('./routes/player')
|
const player = require('./routes/player')
|
||||||
|
|
||||||
const db = require('knex')(config.database)
|
const db = require('knex')(config.database)
|
||||||
|
const isDevMode = process.env.NODE_ENV === 'development'
|
||||||
|
|
||||||
// Helmet security headers
|
// Helmet security headers
|
||||||
if (config.helmet instanceof Object && Object.keys(config.helmet).length) {
|
if (config.helmet instanceof Object && Object.keys(config.helmet).length) {
|
||||||
@ -75,8 +76,8 @@ if (config.trustProxy) {
|
|||||||
nunjucks.configure('views', {
|
nunjucks.configure('views', {
|
||||||
autoescape: true,
|
autoescape: true,
|
||||||
express: safe,
|
express: safe,
|
||||||
watch: process.env.NODE_ENV === 'development'
|
watch: isDevMode
|
||||||
// noCache: process.env.NODE_ENV === 'development'
|
// noCache: isDevMode
|
||||||
})
|
})
|
||||||
safe.set('view engine', 'njk')
|
safe.set('view engine', 'njk')
|
||||||
safe.enable('view cache')
|
safe.enable('view cache')
|
||||||
@ -388,7 +389,7 @@ safe.use('/api', api)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NODE_ENV=development yarn start
|
// NODE_ENV=development yarn start
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (isDevMode) {
|
||||||
// Add readline interface to allow evaluating arbitrary JavaScript from console
|
// Add readline interface to allow evaluating arbitrary JavaScript from console
|
||||||
readline.createInterface({
|
readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
@ -406,7 +407,10 @@ safe.use('/api', api)
|
|||||||
}).on('SIGINT', () => {
|
}).on('SIGINT', () => {
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
logger.log('DEVELOPMENT MODE: Disabled Nunjucks caching & enabled readline interface')
|
logger.log('!!! DEVELOPMENT MODE !!!')
|
||||||
|
logger.log('- Nunjucks will auto rebuild (not live reload)')
|
||||||
|
logger.log('- Rate limits disabled')
|
||||||
|
logger.log('- Readline interface enabled')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error)
|
logger.error(error)
|
||||||
|
Loading…
Reference in New Issue
Block a user