| 36 | */ |
| 37 | export class Bootstrapper { |
| 38 | constructor( |
| 39 | @inject(CoreBindings.APPLICATION_INSTANCE) |
| 40 | private app: Application & Bootable, |
| 41 | @inject(BootBindings.PROJECT_ROOT) private projectRoot: string, |
| 42 | @inject(BootBindings.BOOT_OPTIONS, {optional: true}) |
| 43 | private bootOptions: BootOptions = {}, |
| 44 | ) { |
| 45 | // Resolve path to projectRoot and re-bind |
| 46 | this.projectRoot = resolve(this.projectRoot); |
| 47 | app.bind(BootBindings.PROJECT_ROOT).to(this.projectRoot); |
| 48 | |
| 49 | // This is re-bound for testing reasons where this value may be passed directly |
| 50 | // and needs to be propagated to the Booters via DI |
| 51 | app.bind(BootBindings.BOOT_OPTIONS).to(this.bootOptions); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Function is responsible for calling all registered Booter classes that |