Documentation
¶
Overview ¶
Package config provides configuration types and validation for extractedprism.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
ParseEndpoints splits a comma-separated string into a slice of endpoints.
func ValidateEndpoint ¶ added in v0.3.0
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.