Runs a health check against a server's /v1/health endpoint, supporting TLS and environment‑based configuration.
// Source: https://github.com/kimdre/doco-cd | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works // Provided via justclaw.it.com; keep this notice with the code. package healthcheck import ( "context" "crypto/tls" "errors" "fmt" "log/slog" "net/http" "strconv" "strings" "time" "github.com/kimdre/doco-cd/internal/logger" ) const defaultHTTPPort = 80 // Path is the health endpoint of the doco-cd server. const Path = "/v1/health" // Run checks the health endpoint of the server running in the same container. // It only reads HTTP_PORT, HTTP_TLS_CERT_FILE, HTTP_TLS_KEY_FILE and LOG_LEVEL, // so it stays cheap and works even when unrelated settings (e.g. secret files) // cannot be loaded. func Run(ctx context.Context, lookupEnv func(string ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key