@vendure/core
Version:
A modern, headless ecommerce framework
53 lines (52 loc) • 1.91 kB
TypeScript
import { HealthIndicatorFunction } from '../../health-check/terminus-compat';
import { InjectableStrategy } from '../../common/types/injectable-strategy';
/**
* @description
* This strategy defines health checks which are included as part of the
* `/health` endpoint. They should only be used to monitor _critical_ systems
* on which proper functioning of the Vendure server depends.
*
* Custom strategies should be added to the `systemOptions.healthChecks` array.
* By default, Vendure includes the `TypeORMHealthCheckStrategy`, so if you set the value of the `healthChecks`
* array, be sure to include it manually.
*
* Vendure also ships with the {@link HttpHealthCheckStrategy}, which is convenient
* for adding a health check dependent on an HTTP ping.
*
* :::info
*
* This is configured via the `systemOptions.healthChecks` property of
* your VendureConfig.
*
* :::
*
*
* @example
* ```ts
* import { HttpHealthCheckStrategy, TypeORMHealthCheckStrategy } from '\@vendure/core';
* import { MyCustomHealthCheckStrategy } from './config/custom-health-check-strategy';
*
* export const config = {
* // ...
* systemOptions: {
* healthChecks: [
* new TypeORMHealthCheckStrategy(),
* new HttpHealthCheckStrategy({ key: 'my-service', url: 'https://my-service.com' }),
* new MyCustomHealthCheckStrategy(),
* ],
* },
* };
* ```
*
* @docsCategory health-check
* @deprecated Use infrastructure-level health checks (e.g. Kubernetes probes, Docker healthchecks,
* load balancer checks) instead of application-level health checks. This interface will be removed in v4.0.0.
*/
export interface HealthCheckStrategy extends InjectableStrategy {
/**
* @description
* Should return a {@link HealthIndicatorFunction} which performs the check
* and resolves to a status payload.
*/
getHealthIndicator(): HealthIndicatorFunction;
}