Skip to content
Permalink
Browse files

refactor: fix HealthCheck typo and register to the container

  • Loading branch information...
thetutlage committed Jul 27, 2019
1 parent 9a79d59 commit 39ec2aab6ec396317562074bad0a60e59c68ecd2
Showing with 13 additions and 2 deletions.
  1. +1 −1 adonis-typings/health-check.ts
  2. +11 −0 providers/AppProvider.ts
  3. +1 −1 src/HealthCheck/index.ts
@@ -11,7 +11,7 @@
* The binding for the given module is defined inside `providers/AppProvider.ts`
* file.
*/
declare module '@ioc:Adonis/Core/HealtCheck' {
declare module '@ioc:Adonis/Core/HealthCheck' {
export type Checker = string | (() => Promise<HealthReportEntry>)

/**
@@ -23,6 +23,7 @@ import { Cors } from '../src/Middleware/Cors'
import { HttpExceptionHandler } from '../src/HttpExceptionHandler'
import { envLoader } from '../src/envLoader'
import { RequestLogger } from '../src/HttpHooks/RequestLogger'
import { HealthCheck } from '../src/HealthCheck'

/**
* The application provider that sticks all core components
@@ -149,6 +150,15 @@ export default class AppProvider {
})
}

/**
* Registering the health check provider
*/
protected $registerHealthCheck () {
this.$container.singleton('Adonis/Core/HealthCheck', () => {
return new HealthCheck(this.$container.use('Adonis/Core/Application'))
})
}

/**
* Registering all required bindings to the container
*/
@@ -164,6 +174,7 @@ export default class AppProvider {
this.$registerEmitter()
this.$registerCorsMiddleware()
this.$registerHash()
this.$registerHealthCheck()
}

public boot () {
@@ -9,7 +9,7 @@

import { ApplicationContract } from '@ioc:Adonis/Core/Application'
import { parseIocReference, callIocReference } from '@poppinss/utils'
import { HealthCheckContract, Checker, HealthReport, HealthReportEntry } from '@ioc:Adonis/Core/HealtCheck'
import { HealthCheckContract, Checker, HealthReport, HealthReportEntry } from '@ioc:Adonis/Core/HealthCheck'

/**
* The module exposes the API to find the health, liveliness and readiness of

0 comments on commit 39ec2aa

Please sign in to comment.
You can’t perform that action at this time.