config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration types and validation for extractedprism.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoEndpoints              = errors.New("no endpoints configured")
	ErrInvalidEndpoint          = errors.New("invalid endpoint")
	ErrInvalidPort              = errors.New("invalid port number")
	ErrPortConflict             = errors.New("bind port and health port must differ")
	ErrInvalidHealthTiming      = errors.New("health timeout must be less than health interval")
	ErrInvalidBindAddress       = errors.New("invalid bind address")
	ErrInvalidHealthDuration    = errors.New("invalid health duration")
	ErrInvalidLogLevel          = errors.New("invalid log level")
	ErrInvalidLivenessDuration  = errors.New("invalid liveness duration")
	ErrInvalidLivenessTiming    = errors.New("liveness threshold must be greater than liveness interval")
	ErrInvalidHealthBindAddress = errors.New("invalid health bind address")
)

Sentinel errors for configuration validation.

Functions

func ParseEndpoints

func ParseEndpoints(csv string) []string

ParseEndpoints splits a comma-separated string into a slice of endpoints.

func ValidateEndpoint added in v0.3.0

func ValidateEndpoint(endpoint string) error

ValidateEndpoint checks that a single endpoint string is a valid host:port pair with a valid IP or hostname and a port in range 1-65535.

Types

type Config

type Config struct {
	BindAddress       string
	BindPort          int
	HealthPort        int
	HealthBindAddress string
	Endpoints         []string
	HealthInterval    time.Duration
	HealthTimeout     time.Duration
	EnableDiscovery   bool
	LogLevel          string
	LivenessInterval  time.Duration
	LivenessThreshold time.Duration
}

Config holds all configuration for the extractedprism proxy.

func NewBaseConfig added in v0.3.0

func NewBaseConfig() *Config

NewBaseConfig returns a Config populated with sensible defaults for optional fields. Required fields such as Endpoints must be set by the caller before the config passes Validate.

func (*Config) ApplyDefaults added in v0.3.0

func (cfg *Config) ApplyDefaults()

ApplyDefaults fills in zero-value fields with sensible defaults that depend on other config fields. Call this before Validate. ApplyDefaults is idempotent and safe to call multiple times.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks that the configuration is valid. Validate is a pure validator with no side effects — call ApplyDefaults first to fill in dependent defaults.

Jump to

Keyboard shortcuts

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