Skip to content

Commit

Permalink
refactor: fix HealthCheck typo and register to the container
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jul 27, 2019
1 parent 9a79d59 commit 39ec2aa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adonis-typings/health-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>)

/**
Expand Down
11 changes: 11 additions & 0 deletions providers/AppProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand All @@ -164,6 +174,7 @@ export default class AppProvider {
this.$registerEmitter()
this.$registerCorsMiddleware()
this.$registerHash()
this.$registerHealthCheck()
}

public boot () {
Expand Down
2 changes: 1 addition & 1 deletion src/HealthCheck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 39ec2aa

Please sign in to comment.