Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIConfig ¶ added in v0.2.2
type AIConfig struct {
// OpenAI API key
APIKey string `koanf:"api_key"`
// Model to use for AI SQL generation (default: gpt-4o)
Model string `koanf:"model"`
// MaxTokens is the maximum number of tokens to generate (default: 1024)
MaxTokens int `koanf:"max_tokens"`
// Temperature controls randomness in generation (0.0-1.0, default: 0.1)
Temperature float32 `koanf:"temperature"`
// Enabled indicates whether AI features are enabled
Enabled bool `koanf:"enabled"`
// BaseURL for OpenAI API (default: "", which uses the standard OpenAI API endpoint)
BaseURL string `koanf:"base_url"`
}
AIConfig contains AI service (OpenAI) settings
type AlertsConfig ¶ added in v0.6.0
type AlertsConfig struct {
Enabled bool `koanf:"enabled"`
EvaluationInterval time.Duration `koanf:"evaluation_interval"`
DefaultLookback time.Duration `koanf:"default_lookback"`
HistoryLimit int `koanf:"history_limit"`
AlertmanagerURL string `koanf:"alertmanager_url"`
ExternalURL string `koanf:"external_url"` // Backend URL (for API access)
FrontendURL string `koanf:"frontend_url"` // Frontend URL (for web UI links)
RequestTimeout time.Duration `koanf:"request_timeout"`
TLSInsecureSkipVerify bool `koanf:"tls_insecure_skip_verify"`
}
AlertsConfig controls scheduling behaviour for alert rules and delivery via Alertmanager.
type AuthConfig ¶
type AuthConfig struct {
AdminEmails []string `koanf:"admin_emails"`
SessionDuration time.Duration `koanf:"session_duration"`
MaxConcurrentSessions int `koanf:"max_concurrent_sessions"`
APITokenSecret string `koanf:"api_token_secret"`
DefaultTokenExpiry time.Duration `koanf:"default_token_expiry"`
}
AuthConfig contains authentication settings
type ClickhouseConfig ¶
type ClickhouseConfig struct {
Host string `koanf:"host"`
Port int `koanf:"port"`
Database string `koanf:"database"`
Username string `koanf:"username"`
Password string `koanf:"password"`
}
ClickhouseConfig contains Clickhouse database settings
type Config ¶
type Config struct {
Server ServerConfig `koanf:"server"`
SQLite SQLiteConfig `koanf:"sqlite"`
Clickhouse ClickhouseConfig `koanf:"clickhouse"`
OIDC OIDCConfig `koanf:"oidc"`
Auth AuthConfig `koanf:"auth"`
Logging LoggingConfig `koanf:"logging"`
AI AIConfig `koanf:"ai"`
Alerts AlertsConfig `koanf:"alerts"`
}
Config represents the application configuration
func Load ¶
Load loads the configuration from a file and environment variables. Environment variables with the prefix LOGCHEF_ can override file values. E.g., LOGCHEF_SERVER__PORT will override server.port
func LoadRuntimeConfig ¶ added in v0.6.0
func LoadRuntimeConfig(ctx context.Context, staticConfig *Config, store SettingsStore) *Config
LoadRuntimeConfig loads configuration from both static config and database. Database values override static config values for non-essential settings.
type LoggingConfig ¶
type LoggingConfig struct {
// Level sets the minimum log level (debug, info, warn, error)
Level string `koanf:"level"`
}
LoggingConfig contains logging settings
type OIDCConfig ¶
type OIDCConfig struct {
// Provider URL for OIDC discovery
ProviderURL string `koanf:"provider_url"` // Base URL for OIDC provider discovery
// Different endpoints for OIDC flow
AuthURL string `koanf:"auth_url"` // URL for browser auth redirects
TokenURL string `koanf:"token_url"` // URL for token exchange (server-to-server)
ClientID string `koanf:"client_id"`
ClientSecret string `koanf:"client_secret"`
RedirectURL string `koanf:"redirect_url"`
Scopes []string `koanf:"scopes"`
}
OIDCConfig contains OpenID Connect settings
type SQLiteConfig ¶
type SQLiteConfig struct {
Path string `koanf:"path"`
}
SQLiteConfig contains SQLite database settings
type ServerConfig ¶
type ServerConfig struct {
Port int `koanf:"port"`
Host string `koanf:"host"`
FrontendURL string `koanf:"frontend_url"`
HTTPServerTimeout time.Duration `koanf:"http_server_timeout"`
}
ServerConfig contains HTTP server settings
type SettingsStore ¶ added in v0.6.0
type SettingsStore interface {
GetSettingWithDefault(ctx context.Context, key, defaultValue string) string
GetBoolSetting(ctx context.Context, key string, defaultValue bool) bool
GetIntSetting(ctx context.Context, key string, defaultValue int) int
GetFloat64Setting(ctx context.Context, key string, defaultValue float64) float64
GetDurationSetting(ctx context.Context, key string, defaultValue time.Duration) time.Duration
}
SettingsStore defines the interface for retrieving settings from the database.