From d878d161c091bc32bd65034a8aba49487f83ab75 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sat, 16 Apr 2022 21:37:17 +0700 Subject: [PATCH] style: dev mode messages --- lolisafe.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lolisafe.js b/lolisafe.js index b133b6d..60d4214 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -51,6 +51,7 @@ const nojs = require('./routes/nojs') const player = require('./routes/player') const db = require('knex')(config.database) +const isDevMode = process.env.NODE_ENV === 'development' // Helmet security headers if (config.helmet instanceof Object && Object.keys(config.helmet).length) { @@ -75,8 +76,8 @@ if (config.trustProxy) { nunjucks.configure('views', { autoescape: true, express: safe, - watch: process.env.NODE_ENV === 'development' - // noCache: process.env.NODE_ENV === 'development' + watch: isDevMode + // noCache: isDevMode }) safe.set('view engine', 'njk') safe.enable('view cache') @@ -388,7 +389,7 @@ safe.use('/api', api) } // NODE_ENV=development yarn start - if (process.env.NODE_ENV === 'development') { + if (isDevMode) { // Add readline interface to allow evaluating arbitrary JavaScript from console readline.createInterface({ input: process.stdin, @@ -406,7 +407,10 @@ safe.use('/api', api) }).on('SIGINT', () => { 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) { logger.error(error)