Skip to content

Commit 42c27b6

Browse files
fix: fixed settings to be based by config.environment whether settings.env
1 parent 7240d1f commit 42c27b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/engines/express.engine.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import * as express from 'express';
99
import * as cors from 'cors';
1010
import * as http from 'http';
11-
import { CompatVersions, logger } from '@orchejs/common';
11+
import { CompatVersions, Environment, logger } from '@orchejs/common';
1212
import { Engine } from './';
1313
import {
1414
OrcheRestConfig,
@@ -43,7 +43,7 @@ export class ExpressEngine extends Engine {
4343
this.setupSettings();
4444

4545
// Add Express's extensions
46-
this.config.middlewares = this.config.middlewares || [];
46+
this.config.middlewares = this.config.middlewares;
4747

4848
// Check if CORS should be setup and add it as an extension
4949
if (this.config.corsConfig) {
@@ -98,7 +98,7 @@ export class ExpressEngine extends Engine {
9898
this.app.set('views', settings.views || process.cwd() + '/views');
9999
this.app.set('view engine', settings.viewEngine || undefined);
100100
this.app.set('x-powered-by', settings.xPoweredBy || false);
101-
if (settings['env'] === 'production') {
101+
if (this.config.environment === Environment.Production) {
102102
this.app.set('view cache', settings.viewCache || true);
103103
} else {
104104
this.app.set('view cache', settings.viewCache || undefined);

0 commit comments

Comments
 (0)