|
|
@ -40,7 +40,7 @@ import MailboxBackendController from "./controllers/backend/MailboxBackendContro |
|
|
|
import RedirectBackComponent from "wms-core/components/RedirectBackComponent"; |
|
|
|
import MailAutoConfigController from "./controllers/MailAutoConfigController"; |
|
|
|
import AccountBackendController from "./controllers/backend/AccountBackendController"; |
|
|
|
import packageJson = require('../package.json'); |
|
|
|
import packageJson = require('./package.json'); |
|
|
|
|
|
|
|
export default class App extends Application { |
|
|
|
private magicLinkWebSocketListener?: MagicLinkWebSocketListener<this>; |
|
|
@ -75,12 +75,8 @@ export default class App extends Application { |
|
|
|
} |
|
|
|
|
|
|
|
private registerComponents() { |
|
|
|
const redisComponent = new RedisComponent(); |
|
|
|
const mysqlComponent = new MysqlComponent(); |
|
|
|
|
|
|
|
// Base
|
|
|
|
const expressAppComponent = new ExpressAppComponent(this.addr, this.port); |
|
|
|
this.use(expressAppComponent); |
|
|
|
this.use(new ExpressAppComponent(this.addr, this.port)); |
|
|
|
this.use(new LogRequestsComponent()); |
|
|
|
|
|
|
|
// Static files
|
|
|
@ -89,21 +85,21 @@ export default class App extends Application { |
|
|
|
|
|
|
|
// Dynamic views and routes
|
|
|
|
this.use(new NunjucksComponent()); |
|
|
|
this.use(new RedirectBackComponent()); |
|
|
|
this.use(new PreviousUrlComponent()); |
|
|
|
|
|
|
|
// Maintenance
|
|
|
|
this.use(new MaintenanceComponent(this, () => { |
|
|
|
return redisComponent.canServe() && mysqlComponent.canServe(); |
|
|
|
return this.as(RedisComponent).canServe() && this.as(MysqlComponent).canServe(); |
|
|
|
})); |
|
|
|
this.use(new AutoUpdateComponent()); |
|
|
|
|
|
|
|
// Services
|
|
|
|
this.use(mysqlComponent); |
|
|
|
this.use(new MysqlComponent()); |
|
|
|
this.use(new MailComponent()); |
|
|
|
|
|
|
|
// Session
|
|
|
|
this.use(redisComponent); |
|
|
|
this.use(new SessionComponent(redisComponent)); |
|
|
|
this.use(new RedisComponent()); |
|
|
|
this.use(new SessionComponent(this.as(RedisComponent))); |
|
|
|
|
|
|
|
// Utils
|
|
|
|
this.use(new FormHelperComponent()); |
|
|
@ -120,7 +116,7 @@ export default class App extends Application { |
|
|
|
}(this))); |
|
|
|
|
|
|
|
// WebSocket server
|
|
|
|
this.use(new WebSocketServerComponent(this, expressAppComponent, redisComponent)); |
|
|
|
this.use(new WebSocketServerComponent(this, this.as(ExpressAppComponent), this.as(RedisComponent))); |
|
|
|
|
|
|
|
// LDAP server
|
|
|
|
this.use(new LDAPServerComponent()); |
|
|
|