Documentation
¶
Overview ¶
Package config handles configuration loading from YAML, CLI flags, and environment variables.
Index ¶
- func ConfigDir() (string, error)
- func DefaultConfigPath() (string, error)
- func DefaultDBPath() (string, error)
- func GenerateToken() (string, error)
- type AnalyticsConfig
- type AuthConfig
- type Config
- type MemoryConfig
- type PersistenceConfig
- type ProxyConfig
- type RedactionConfig
- type RetentionConfig
- type TaskConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
DefaultConfigPath returns the default config file path.
func DefaultDBPath ¶
DefaultDBPath returns the default database path.
func GenerateToken ¶
GenerateToken generates a cryptographically random auth token. Exported for use by CLI commands (token rotate).
Types ¶
type AnalyticsConfig ¶
type AnalyticsConfig struct {
AnomalyContextTokens int `yaml:"anomaly_context_tokens"`
AnomalyToolDelayMs int `yaml:"anomaly_tool_delay_ms"`
AnomalyRapidCallsWindowS int `yaml:"anomaly_rapid_calls_window_s"`
AnomalyRapidCallsThreshold int `yaml:"anomaly_rapid_calls_threshold"`
}
AnalyticsConfig configures anomaly detection thresholds.
type AuthConfig ¶
type AuthConfig struct {
Token string `yaml:"token"` // Bearer token for API access
}
AuthConfig configures API authentication.
type Config ¶
type Config struct {
Proxy ProxyConfig `yaml:"proxy"`
Memory MemoryConfig `yaml:"memory"`
Persistence PersistenceConfig `yaml:"persistence"`
Analytics AnalyticsConfig `yaml:"analytics"`
Retention RetentionConfig `yaml:"retention"`
Redaction RedactionConfig `yaml:"redaction"`
Auth AuthConfig `yaml:"auth"`
Task TaskConfig `yaml:"task"`
}
Config is the root configuration structure.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with secure defaults.
type MemoryConfig ¶
type MemoryConfig struct {
MaxFlows int `yaml:"max_flows"` // N - flows in RAM
MaxEventsPerFlow int `yaml:"max_events_per_flow"` // M - events per flow in RAM
}
MemoryConfig configures in-memory caching.
type PersistenceConfig ¶
type PersistenceConfig struct {
DBPath string `yaml:"db_path"`
BodyMaxBytes int `yaml:"body_max_bytes"`
EventBatchSize int `yaml:"event_batch_size"`
EventBatchTimeoutMs int `yaml:"event_batch_timeout_ms"`
QueueMaxSize int `yaml:"queue_max_size"`
}
PersistenceConfig configures SQLite persistence.
type ProxyConfig ¶
type ProxyConfig struct {
Listen string `yaml:"listen"` // e.g., "localhost:9090"
Host string `yaml:"host"` // Bind host
Port int `yaml:"port"` // Bind port (alternative to listen)
InterceptHosts []string `yaml:"intercept_hosts"` // Additional hosts to MITM (e.g., Azure OpenAI, OpenRouter)
}
ProxyConfig configures the HTTP/TLS proxy.
func (*ProxyConfig) ListenAddr ¶
func (c *ProxyConfig) ListenAddr() string
Listen returns the listen address, handling host:port vs listen field.
type RedactionConfig ¶
type RedactionConfig struct {
AlwaysRedactHeaders []string `yaml:"always_redact_headers"`
PatternRedactHeaders []string `yaml:"pattern_redact_headers"`
RedactAPIKeys bool `yaml:"redact_api_keys"`
RedactBase64Images bool `yaml:"redact_base64_images"`
DisableBodyStorage bool `yaml:"disable_body_storage"`
}
RedactionConfig configures credential redaction.
func (*RedactionConfig) HeaderShouldRedact ¶
func (c *RedactionConfig) HeaderShouldRedact(name string) bool
HeaderShouldRedact checks if a header name should be redacted.
type RetentionConfig ¶
type RetentionConfig struct {
FlowsTTLDays int `yaml:"flows_ttl_days"`
EventsTTLDays int `yaml:"events_ttl_days"`
BodiesTTLDays int `yaml:"bodies_ttl_days"`
DropLogTTLDays int `yaml:"drop_log_ttl_days"`
}
RetentionConfig configures data retention TTLs.
type TaskConfig ¶
type TaskConfig struct {
IdleGapMinutes int `yaml:"idle_gap_minutes"` // Minutes of inactivity before starting new task
}
TaskConfig configures task grouping behavior.