#!/usr/bin/env node /** * MailDev container healthcheck * * Standalone entrypoint used by the Docker HEALTHCHECK. It reads the same * MAILDEV_* environment variables the server uses and probes the endpoint that * is actually listening: * * - Web UI enabled -> HTTP(S) GET http(s)://127.0.0.1:/api/healthz * - Web UI disabled -> TCP connect to 127.0.0.1: * * Design notes (each addresses a reported bug): * - Always targets `127.0.0.1`, never `localhost`, so it can't fail when * `localhost` resolves to IPv6 (`::1`) but the server binds IPv4 only. (#537) * - Falls back to the SMTP port when the web UI is disabled, so * `--disable-web` containers still report healthy. (#544) * - Normalizes the base path so a trailing slash can't produce a `//` in the * probe URL. (#542) * - Probes over HTTPS (ignoring the self-signed cert) when MAILDEV_HTTPS is * set, so TLS-enabled containers don't report unhealthy. The env var is the * same one that turns HTTPS on, so the probe always matches the server. */ export interface HealthcheckPlan { mode: 'web' | 'smtp'; host: string; port: number; /** Request path for `web` mode. */ path?: string; /** Use HTTPS (ignoring cert validation) for `web` mode. */ secure?: boolean; } /** Normalize a base pathname to `''` or `/foo` (leading slash, no trailing slash). */ export declare function normalizeBasePath(raw: string | undefined): string; /** * Decide what to probe based on the MailDev environment configuration. */ export declare function resolveHealthcheck(env: NodeJS.ProcessEnv): HealthcheckPlan; /** * Run the healthcheck against the given environment. Resolves `true` when the * relevant MailDev service is reachable. */ export declare function runHealthcheck(env?: NodeJS.ProcessEnv): Promise; //# sourceMappingURL=healthcheck.d.ts.map