serve

package
v0.154.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 41 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func Start(c *gcli.Command, cfg *config.Config, opts Opts) error

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
	// DEPRECATED(v0.94): remove in v0.97; callers should pass the resolved
	// startup path in CfgPath. Kept temporarily for embedded callers.
	ReloadPath 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 loaded config file (empty = defaults + discovery), ReloadPath is the path the SIGHUP reload loop re-loads from (config.InputCfgFile).

Jump to

Keyboard shortcuts

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