Documentation
¶
Overview ¶
Package serve holds the serve process orchestration (BP2): it builds the runtime Core, starts the periodic sweepers / health probe / SIGHUP reload loops, wires the httpapi server and blocks until the server stops. The commands layer keeps only flag binding + a thin call into serve.Start, so the process编排 lives below the entry layer (D-B2/D-B3: serve depends on core/job/runner/httpapi/metrics/config, and is never imported back by them).
Index ¶
Constants ¶
const ExitErr = 2
ExitErr is the process exit code used when serve fails to start or run. gcli derives the process exit code from errorx.ErrorCoder errors, so serve returns coded errors to guarantee a non-zero exit (plan §11: refuse to start without a token).
Variables ¶
This section is empty.
Functions ¶
func Start ¶
Start runs the serve process: assemble Core, start the sweeper / probe / reload loops, wire the httpapi server and block until it stops. It keeps the *gcli.Command so the c.Printf operator logging is byte-for-byte unchanged (zero behaviour change). cfg is the already-loaded config (the caller passes the discovered path via opts.CfgPath).
Types ¶
type Opts ¶
type Opts struct {
Addr string
Token string
AllowEmptyTok bool
NoWeb bool
WebDir string
CfgPath string
Build buildinfo.Info
}
Opts collects the serve flags + resolved config paths the commands layer passes into Start. The config itself is loaded by the caller (so it can print the discovered path and apply overlays before assembling Core); CfgPath is the path actually selected by config.Load (empty = defaults + discovery); the SIGHUP, Windows-event and HTTP reloads all re-read that same file.