config

package
v1.40.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config handles loading, validating, and applying defaults to Packhorse configuration files.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoNumericValue = errors.New("no numeric value found")
	ErrInvalidNumber  = errors.New("invalid number")
	ErrUnknownUnit    = errors.New("unknown unit")
)

Functions

func ApplyDefaults

func ApplyDefaults(cfg *configpb.Config)

ApplyDefaults fills in default values for optional fields not set in the config file.

func Load

func Load(path string) (*configpb.Config, error)

Load loads and validates the configuration file using the LabKit config loader.

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a Go-style duration string, returning zero if empty.

func ParseSizeString

func ParseSizeString(s string) (int64, error)

ParseSizeString parses a human-readable size string like "50GB" into bytes.

Types

type ServerTimeouts

type ServerTimeouts struct {
	Read       time.Duration
	ReadHeader time.Duration
	Write      time.Duration
	Idle       time.Duration
	// Shutdown bounds the graceful shutdown: how long http.Server.Shutdown
	// waits for in-flight requests to finish after it stops accepting new
	// connections.
	Shutdown time.Duration
	// Drain is the pre-shutdown grace period, not the in-flight drain (that's
	// Shutdown). It keeps the server accepting NEW connections while Kubernetes
	// endpoint removal -- triggered by pod deletion, not the readiness probe --
	// propagates through kube-proxy, so requests still routed to the pod are
	// served rather than refused. Readiness is also failed (readyz -> 503) as
	// complementary signaling.
	Drain time.Duration
}

ServerTimeouts holds parsed duration values for all server timeout fields.

func ParseServerTimeouts

func ParseServerTimeouts(s *configpb.ServerConfig) (ServerTimeouts, error)

ParseServerTimeouts parses all server timeout fields from the config.

Directories

Path Synopsis
packhorse

Jump to

Keyboard shortcuts

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