Documentation
¶
Overview ¶
Package doctor runs end-to-end preflight diagnostics for a notifycat installation. It bundles config, database, and mappings-file checks the server would otherwise only surface at startup, and (for a target repository) delegates the per-mapping Slack + GitHub checks to internal/validate. The CLI entry point lives in cmd/notifycat-doctor.
Orchestration lives here; each section's checks live in their own *_check.go file (config_check.go, database_check.go, mappings_check.go), and the okResult/failResult/skip constructors live in helpers.go — the same layout the sibling internal/validate package uses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteReport ¶
WriteReport renders sections to w in a human-readable, greppable form, and returns true iff no check failed (skipped checks do not fail the report). The format is intentionally plain text: one section header per group, then one indented line per check.
Types ¶
type Doctor ¶
type Doctor struct {
// contains filtered or unexported fields
}
Doctor bundles a parsed config with an optional RepoValidator. Construct once via NewDoctor; Run is safe to call multiple times.
func NewDoctor ¶
func NewDoctor(cfg config.Config, validator RepoValidator) *Doctor
NewDoctor returns a Doctor wired to cfg and validator. validator may be nil — Run then skips the per-repo Slack/GitHub checks even when a target repository is given.
type RepoValidator ¶
RepoValidator is the slice of validate.Validator the doctor needs. It stays in this consumer package so tests can supply a hand-written fake without depending on the live Slack / GitHub clients.
type Section ¶
type Section struct {
Name string
Checks []validate.CheckResult
}
Section is a named group of related checks (e.g. "config", "database", "octo/widget"). Each section's checks are independent — a single FAIL in one section does not short-circuit other sections.
func CheckConfig ¶
CheckConfig inspects cfg and reports per-field results. Secret values are never written to Detail — the result reports only "set" or "missing".
func CheckDatabase ¶
CheckDatabase opens dsn, pings the underlying connection, and reports the result. It does not run migrations — that is the server's job.
func CheckMappings ¶ added in v0.17.0
CheckMappings reports whether the `mappings:` section of config.yaml parsed into any entries. An empty section is OK (the server boots but routes nothing). Parse failures already surface in config load, so by the time the doctor has a provider the file is structurally valid.