|
|
|
@ -54,6 +54,8 @@ export class Application extends Container {
|
|
|
|
|
protected applicationUnits: (typeof Unit)[] = []
|
|
|
|
|
protected instantiatedUnits: Unit[] = []
|
|
|
|
|
|
|
|
|
|
public forceStartupMessage: boolean = true
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super()
|
|
|
|
|
|
|
|
|
@ -70,6 +72,10 @@ export class Application extends Container {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public hasUnit(unitClass: typeof Unit) {
|
|
|
|
|
return this.applicationUnits.includes(unitClass)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get root() {
|
|
|
|
|
return this.basePath.concat()
|
|
|
|
|
}
|
|
|
|
@ -150,7 +156,7 @@ export class Application extends Container {
|
|
|
|
|
async up() {
|
|
|
|
|
const logging: Logging = this.make<Logging>(Logging)
|
|
|
|
|
|
|
|
|
|
logging.info('Starting Extollo...', true)
|
|
|
|
|
logging.info('Starting Extollo...', this.forceStartupMessage)
|
|
|
|
|
for ( const unitClass of this.applicationUnits ) {
|
|
|
|
|
const unit: Unit = this.make<Unit>(unitClass)
|
|
|
|
|
this.instantiatedUnits.push(unit)
|
|
|
|
@ -161,8 +167,8 @@ export class Application extends Container {
|
|
|
|
|
async down() {
|
|
|
|
|
const logging: Logging = this.make<Logging>(Logging)
|
|
|
|
|
|
|
|
|
|
logging.info('Stopping Extollo...', true)
|
|
|
|
|
for ( const unit of this.instantiatedUnits ) {
|
|
|
|
|
logging.info('Stopping Extollo...', this.forceStartupMessage)
|
|
|
|
|
for ( const unit of [...this.instantiatedUnits].reverse() ) {
|
|
|
|
|
if ( !unit ) continue
|
|
|
|
|
await this.stopUnit(unit)
|
|
|
|
|
}
|
|
|
|
|