doctor

package
v0.11.0-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownMarchatEnvKeys = []string{
	"MARCHAT_CONFIG_DIR",
	"MARCHAT_PORT",
	"MARCHAT_ADMIN_KEY",
	"MARCHAT_USERS",
	"MARCHAT_DB_PATH",
	"MARCHAT_LOG_LEVEL",
	"MARCHAT_SESSION_SECRET",
	"MARCHAT_JWT_SECRET",
	"MARCHAT_TLS_CERT_FILE",
	"MARCHAT_TLS_KEY_FILE",
	"MARCHAT_BAN_HISTORY_GAPS",
	"MARCHAT_PLUGIN_REGISTRY_URL",
	"MARCHAT_MAX_FILE_BYTES",
	"MARCHAT_MAX_FILE_MB",
	"MARCHAT_GLOBAL_E2E_KEY",
	"MARCHAT_ALLOWED_USERS",
	"MARCHAT_DOCTOR_NO_NETWORK",
}

KnownMarchatEnvKeys lists documented MARCHAT_* variables for doctor output.

Functions

func FormatEnvValue

func FormatEnvValue(key, value string) string

FormatEnvValue returns a human-safe display string for an environment value.

func ParseLatestReleaseTag

func ParseLatestReleaseTag(body []byte) (string, error)

ParseLatestReleaseTag extracts tag_name from a GitHub releases/latest JSON body (for tests).

func ResolveServerConfigDir

func ResolveServerConfigDir(configDirFlag string) string

ResolveServerConfigDir returns the server configuration directory using the same rules as cmd/server: MARCHAT_CONFIG_DIR, --config-dir flag, then dev (./config) or ~/.config/marchat.

func RunClient

func RunClient(o Options) error

RunClient writes a client-focused doctor report.

func RunServer

func RunServer(o Options) error

RunServer writes a server-focused doctor report.

Types

type Check

type Check struct {
	ID      string `json:"id"`
	Status  string `json:"status"` // ok, warn, error
	Message string `json:"message"`
}

Check is one diagnostic line in the report.

type Options

type Options struct {
	Out io.Writer

	// JSON emits machine-readable JSON instead of text lines.
	JSON bool

	// HTTPClient is used for the GitHub latest-release check (optional).
	HTTPClient *http.Client

	// ServerConfigDirFlag is the value of the server's -config-dir flag (may be empty).
	ServerConfigDirFlag string
}

Options configures doctor output and networking.

type Report

type Report struct {
	Role          string     `json:"role"`
	Version       string     `json:"version"`
	VersionDetail string     `json:"version_detail"`
	GoVersion     string     `json:"go_version"`
	GOOS          string     `json:"goos"`
	GOARCH        string     `json:"goarch"`
	StdoutTTY     bool       `json:"stdout_tty"`
	ConfigDir     string     `json:"config_dir,omitempty"`
	Environment   []envLine  `json:"environment"`
	Checks        []Check    `json:"checks"`
	Update        UpdateInfo `json:"update"`
}

Report is the full doctor payload for JSON output.

type UpdateInfo

type UpdateInfo struct {
	Current    string `json:"current"`
	Latest     string `json:"latest,omitempty"`
	UpToDate   bool   `json:"up_to_date"`
	Skipped    bool   `json:"skipped"`
	SkipReason string `json:"skip_reason,omitempty"`
	Error      string `json:"error,omitempty"`
}

UpdateInfo describes a remote version comparison (if available).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL