Skip to content

Commit

Permalink
feat(healthChecks): introduce servicesList property to get names of r…
Browse files Browse the repository at this point in the history
…egistered services
  • Loading branch information
thetutlage committed Dec 26, 2019
1 parent 173a56c commit 2241ce3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions adonis-typings/health-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare module '@ioc:Adonis/Core/HealthCheck' {
* Shape of health check contract
*/
export interface HealthCheckContract {
servicesList: string[],
addChecker (service: string, checker: Checker): void,
isLive (): Promise<boolean>,
isReady (): boolean,
Expand Down
7 changes: 7 additions & 0 deletions src/HealthCheck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export class HealthCheck implements HealthCheckContract {
*/
private resolver: IocResolverContract = this.application.container.getResolver('report')

/**
* Returns an array of registered services names
*/
public get servicesList (): string[] {
return Object.keys(this.healthCheckers)
}

constructor (private application: ApplicationContract) {}

/**
Expand Down

0 comments on commit 2241ce3

Please sign in to comment.