Documentation
¶
Overview ¶
Package config loads and validates the poolctl YAML configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
Type string `yaml:"type"` // http | command
URL string `yaml:"url"`
Method string `yaml:"method"`
Headers map[string]string `yaml:"headers"`
SuccessStatus []int `yaml:"success_status"`
TimeoutSec int `yaml:"timeout_sec"`
Cmd string `yaml:"cmd"` // for type: command
SuccessOutput string `yaml:"success_output"` // substring that marks success
}
Check describes how a token is validated.
type Config ¶
type Config struct {
TokensFile string `yaml:"tokens_file"`
Rotation string `yaml:"rotation"` // lru | round_robin | random | weighted
CooldownSec int `yaml:"cooldown_sec"`
RecheckIntervalSec int `yaml:"recheck_interval_sec"`
Check Check `yaml:"check"`
Refresh Refresh `yaml:"refresh"`
Proxy string `yaml:"proxy"`
Server Server `yaml:"server"`
Upstream Upstream `yaml:"upstream"`
Metrics Metrics `yaml:"metrics"`
StateFile string `yaml:"state_file"`
}
Config is the top-level poolctl configuration.
type Metrics ¶
type Metrics struct {
Addr string `yaml:"addr"` // if set, serve /metrics here
}
Metrics configures the Prometheus text endpoint.
type Refresh ¶
type Refresh struct {
Enabled bool `yaml:"enabled"`
URL string `yaml:"url"`
Method string `yaml:"method"`
Headers map[string]string `yaml:"headers"`
Body string `yaml:"body"`
TokenField string `yaml:"token_field"` // JSON field holding the new token
TimeoutSec int `yaml:"timeout_sec"`
}
Refresh describes an optional token-refresh call (OAuth-style).
type Upstream ¶
type Upstream struct {
Enabled bool `yaml:"enabled"`
Listen string `yaml:"listen"` // proxy listen address
BaseURL string `yaml:"base_url"` // e.g. https://api.openai.com
AuthHeader string `yaml:"auth_header"` // header the token is injected into
AuthTemplate string `yaml:"auth_template"` // value template, {token} substituted
RetryOn []int `yaml:"retry_on"` // upstream statuses that trigger a retry
MaxRetries int `yaml:"max_retries"` // extra attempts beyond the first
QuarantineSec int `yaml:"quarantine_sec"` // rest after a 401/403 (hard) failure
CooldownSec int `yaml:"cooldown_sec"` // rest after a 429/5xx (soft) failure
TimeoutSec int `yaml:"timeout_sec"` // per-attempt upstream timeout
}
Upstream configures the passthrough reverse proxy (LLM/API-gateway mode). Each incoming request borrows a healthy token, injects it as a header, and forwards to BaseURL; a retryable status is retried with a different token.
Click to show internal directories.
Click to hide internal directories.