...
|
...
|
@@ -30,8 +30,20 @@ const stringProcess = require('./utils/string-process'); |
|
|
const app = express();
|
|
|
|
|
|
// 向模板注入变量
|
|
|
global.devEnv = app.locals.devEnv = app.get('env') === 'development';
|
|
|
global.isProduction = app.locals.isProduction = app.get('env') === 'production';
|
|
|
switch (app.get('env')) {
|
|
|
case 'development':
|
|
|
global.devEnv = app.locals.devEnv = true;
|
|
|
break;
|
|
|
case 'test':
|
|
|
global.isTest = app.locals.isTest = true;
|
|
|
break;
|
|
|
case 'production':
|
|
|
global.isProduction = app.locals.isProduction = true;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
global.version = app.locals.version = pkg.version;
|
|
|
app.locals.startTime = moment().format('YYYYMMDDHH');
|
|
|
app.locals.currentYear = moment().format('YYYY');
|
...
|
...
|
|