Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TCPAddrFromDBConfig ¶
func TCPAddrFromDBConfig(db config.DatabaseConfig) string
TCPAddrFromDBConfig returns host:port for the configured database, or "" if the database is local-only (SQLite, or postgres without a TCP address). For PostgreSQL it parses the libpq DSN form `postgres://user:pass@host:port/db?...` or the `key=value` form (`host=... port=...`).
func TCPAddrFromHTTPURL ¶
TCPAddrFromHTTPURL extracts host:port from an http:// or https:// URL. Returns empty string if the URL cannot be parsed or has no host. Defaults to 80 for http and 443 for https when the URL omits a port.
func TCPAddrFromRedisURL ¶
TCPAddrFromRedisURL extracts host:port from a redis:// URL. Returns empty string if the URL cannot be parsed or has no host. Defaults to port 6379 if the URL omits a port.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker runs system checks and caches the latest report. It separates static (startup) checks from dynamic (re-runnable) checks.
func NewChecker ¶
func NewChecker(deps RuntimeDeps) *Checker
NewChecker creates a Checker with the given runtime dependencies. Call Init to populate static results and run the first dynamic check.
func (*Checker) Init ¶
Init records the startup check results (config + docker) as static, then runs a first dynamic check pass. This should be called once during server startup, after all dependencies are initialized.
type Report ¶
type Report struct {
RanAt time.Time `json:"ran_at"`
Results []Result `json:"results"`
Summary Summary `json:"summary"`
}
Report collects all check results.
func RunConfigChecks ¶
RunConfigChecks evaluates checks that need only the parsed config. Safe to call immediately after config.Load().
func (*Report) HasWarnings ¶
HasWarnings returns true if any result has SeverityWarning or above.
type Result ¶
type Result struct {
Name string `json:"name"`
Severity Severity `json:"severity"`
Message string `json:"message"`
Category string `json:"category"` // "config", "docker", "runtime"
}
Result describes the outcome of a single check.
type RuntimeDeps ¶
type RuntimeDeps struct {
StorePath string // pkg-store volume root (for disk space check)
DBPing func(ctx context.Context) error // database health
BackendPing func(ctx context.Context) error // backend health (Docker socket, process backend liveness, etc.)
RedisPing func(ctx context.Context) error // Redis health (nil = no Redis)
IDPCheck func(ctx context.Context) error // OIDC IdP health (nil = no OIDC)
VaultCheck func(ctx context.Context) error // OpenBao health (nil = no vault)
VaultTokenOK func() bool // AppRole token health (nil = no AppRole)
UpdateAvailable func() string // latest version when an update is recommended; "" otherwise
ServerVersion string
}
RuntimeDeps provides the dependencies for dynamic (re-runnable) checks. All function fields are called on demand; nil means the check is skipped.
type Severity ¶
type Severity int
Severity classifies the urgency of a check result. Values are ordered so that higher severity sorts first in descending order.
func (Severity) MarshalJSON ¶
MarshalJSON serializes Severity as a lowercase JSON string.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON parses a Severity from a JSON string.