Skip to content

Health Checker

The health checker is an optional service that can be provided to the portal. Once added will be called periodically with an interval defined in the environment variable HEALTH_CHECK_INTERVAL ms (default 2000 in case not set). The result of the call is accessed via rest call /rest/health and throws an error if the result is false.

HealthChecker Interface

The interface is defined as follows:

ts
export interface HealthChecker {
    isHealthy(): Promise<boolean>;
}

Provide your implemented service to the portal options

ts
import { Module } from '@nestjs/common';
import {
    PortalModule,
    PortalModuleOptions,
} from '@openmfp/portal-server-lib';

const portalOptions: PortalModuleOptions = {
    healthChecker: HealthCheckerImpl,
};

@Module({
    imports: [PortalModule.create(portalOptions)],
})
export class AppModule {}
EU and German government funding logos

Funded by the European Union – NextGenerationEU.

The views and opinions expressed are solely those of the author(s) and do not necessarily reflect the views of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them.