Expand description
doctor — pre-flight environment validation command.
Pattern §48: Every server binary MUST implement a doctor subcommand that
validates the environment and reports what’s missing before the user tries
to start the server.
§Usage
example doctor # human-readable coloured output; exit 0/1
example doctor --json # machine-readable JSON; exit 0/1§CUSTOMIZE
This is the reference implementation for the soma family. When you clone Soma for a real service, the things you MUST change are:
- Replace
SOMA_API_URL/SOMA_API_KEYwith your service’s env vars. - Replace
"soma"binary name with your binary name incheck_binary_in_path. - Replace
~/.soma/data dir with your service’s data dir (seeconfig::default_data_dir). - Add any service-specific checks (e.g. database connectivity, auth token format).
- Update the
print_doctor_reportsection headings and hint text to match your service.
Nothing else here needs changing for a basic deployment. Business logic for the
checks belongs in the individual check_* functions — never in run_doctor.
Structs§
- Doctor
Check - A single pre-flight check result.
Functions§
- run_
doctor - Run the doctor command.