Documentation
¶
Overview ¶
Package config provides application configuration.
Package config provides application configuration.
Index ¶
- Constants
- func DefaultCloneDir(dataDir string) string
- func DefaultDataDir() string
- func DefaultLogger() *slog.Logger
- func LoadDotEnv(path string) error
- func LoadDotEnvFromFiles(paths ...string) error
- func MustLoadDotEnv(path string) error
- func OverloadDotEnvFromFiles(paths ...string) error
- func ParseAPIKeys(s string) []string
- func PrepareCloneDir(cloneDir, dataDir string) (string, error)
- func PrepareDataDir(dataDir string) (string, error)
- type AppConfig
- func (c AppConfig) APIKeys() []string
- func (c AppConfig) Addr() string
- func (c AppConfig) Apply(opts ...AppConfigOption) AppConfig
- func (c AppConfig) ChunkMinSize() int
- func (c AppConfig) ChunkOverlap() int
- func (c AppConfig) ChunkSize() int
- func (c AppConfig) CloneDir() string
- func (c AppConfig) DBURL() string
- func (c AppConfig) DataDir() string
- func (c AppConfig) DisableTelemetry() bool
- func (c AppConfig) EmbeddingEndpoint() *Endpoint
- func (c AppConfig) EnrichmentEndpoint() *Endpoint
- func (c AppConfig) EnsureCloneDir() error
- func (c AppConfig) EnsureDataDir() error
- func (c AppConfig) EnsureLiteLLMCacheDir() error
- func (c AppConfig) HTTPCacheDir() string
- func (c AppConfig) Host() string
- func (c AppConfig) IsRemote() bool
- func (c AppConfig) LiteLLMCache() LiteLLMCacheConfig
- func (c AppConfig) LiteLLMCacheDir() string
- func (c AppConfig) LogAttrs() []slog.Attr
- func (c AppConfig) LogFormat() LogFormat
- func (c AppConfig) LogLevel() string
- func (c AppConfig) PeriodicSync() PeriodicSyncConfig
- func (c AppConfig) Port() int
- func (c AppConfig) Remote() RemoteConfig
- func (c AppConfig) Reporting() ReportingConfig
- func (c AppConfig) SearchLimit() int
- func (c AppConfig) SimpleChunking() bool
- func (c AppConfig) SkipProviderValidation() bool
- func (c AppConfig) WorkerCount() int
- type AppConfigOption
- func WithAPIKeys(keys []string) AppConfigOption
- func WithChunkMinSize(minSize int) AppConfigOption
- func WithChunkOverlap(overlap int) AppConfigOption
- func WithChunkSize(size int) AppConfigOption
- func WithDBURL(url string) AppConfigOption
- func WithDataDir(dir string) AppConfigOption
- func WithDisableTelemetry(disabled bool) AppConfigOption
- func WithEmbeddingEndpoint(e Endpoint) AppConfigOption
- func WithEnrichmentEndpoint(e Endpoint) AppConfigOption
- func WithHTTPCacheDir(dir string) AppConfigOption
- func WithHost(host string) AppConfigOption
- func WithLiteLLMCacheConfig(l LiteLLMCacheConfig) AppConfigOption
- func WithLogFormat(format LogFormat) AppConfigOption
- func WithLogLevel(level string) AppConfigOption
- func WithPeriodicSyncConfig(p PeriodicSyncConfig) AppConfigOption
- func WithPort(port int) AppConfigOption
- func WithRemoteConfig(r RemoteConfig) AppConfigOption
- func WithReportingConfig(r ReportingConfig) AppConfigOption
- func WithSearchLimit(n int) AppConfigOption
- func WithSimpleChunking(enabled bool) AppConfigOption
- func WithSkipProviderValidation(skip bool) AppConfigOption
- func WithWorkerCount(n int) AppConfigOption
- type Endpoint
- func (e Endpoint) APIKey() string
- func (e Endpoint) BackoffFactor() float64
- func (e Endpoint) BaseURL() string
- func (e Endpoint) ExtraParams() map[string]any
- func (e Endpoint) InitialDelay() time.Duration
- func (e Endpoint) IsConfigured() bool
- func (e Endpoint) MaxBatchChars() int
- func (e Endpoint) MaxBatchSize() int
- func (e Endpoint) MaxRetries() int
- func (e Endpoint) MaxTokens() int
- func (e Endpoint) Model() string
- func (e Endpoint) NumParallelTasks() int
- func (e Endpoint) SocketPath() string
- func (e Endpoint) Timeout() time.Duration
- type EndpointEnv
- type EndpointOption
- func WithAPIKey(key string) EndpointOption
- func WithBackoffFactor(f float64) EndpointOption
- func WithBaseURL(url string) EndpointOption
- func WithExtraParams(params map[string]any) EndpointOption
- func WithInitialDelay(d time.Duration) EndpointOption
- func WithMaxBatchChars(n int) EndpointOption
- func WithMaxBatchSize(n int) EndpointOption
- func WithMaxRetries(n int) EndpointOption
- func WithMaxTokens(n int) EndpointOption
- func WithModel(model string) EndpointOption
- func WithNumParallelTasks(n int) EndpointOption
- func WithSocketPath(path string) EndpointOption
- func WithTimeout(d time.Duration) EndpointOption
- type EnvConfig
- type LiteLLMCacheConfig
- type LiteLLMCacheEnv
- type LogFormat
- type PeriodicSyncConfig
- func (p PeriodicSyncConfig) CheckInterval() time.Duration
- func (p PeriodicSyncConfig) Enabled() bool
- func (p PeriodicSyncConfig) Interval() time.Duration
- func (p PeriodicSyncConfig) RetryAttempts() int
- func (p PeriodicSyncConfig) WithCheckIntervalSeconds(seconds float64) PeriodicSyncConfig
- func (p PeriodicSyncConfig) WithEnabled(enabled bool) PeriodicSyncConfig
- func (p PeriodicSyncConfig) WithIntervalSeconds(seconds float64) PeriodicSyncConfig
- func (p PeriodicSyncConfig) WithRetryAttempts(attempts int) PeriodicSyncConfig
- type PeriodicSyncEnv
- type RemoteConfig
- type RemoteConfigOption
- type RemoteEnv
- type ReportingConfig
- type ReportingEnv
Constants ¶
const ( DefaultHost = "0.0.0.0" DefaultPort = 8080 DefaultLogLevel = "INFO" DefaultWorkerCount = 1 DefaultSearchLimit = 10 DefaultCloneSubdir = "repos" DefaultEndpointParallelTasks = 1 DefaultEndpointTimeout = 60 * time.Second DefaultEndpointMaxRetries = 5 DefaultEndpointInitialDelay = 2 * time.Second DefaultEndpointBackoffFactor = 2.0 DefaultEndpointMaxTokens = 4000 DefaultPeriodicSyncInterval = 1800.0 // seconds DefaultPeriodicSyncCheckInterval = 10.0 // seconds DefaultPeriodicSyncRetries = 3 DefaultEndpointMaxBatchChars = 16000 DefaultEndpointMaxBatchSize = 1 DefaultRemoteTimeout = 30 * time.Second DefaultRemoteMaxRetries = 3 DefaultReportingInterval = 5 * time.Second )
Default configuration values.
Variables ¶
This section is empty.
Functions ¶
func DefaultCloneDir ¶
DefaultCloneDir returns the default clone directory for a given data directory.
func DefaultDataDir ¶
func DefaultDataDir() string
DefaultDataDir returns the default data directory.
func DefaultLogger ¶
DefaultLogger returns the default slog logger for library consumers.
func LoadDotEnv ¶
LoadDotEnv loads environment variables from a .env file. If path is empty, it loads from ".env" in the current directory. If the file does not exist, it silently returns nil (not an error).
func LoadDotEnvFromFiles ¶
LoadDotEnvFromFiles loads environment variables from multiple .env files. Files are processed in order. Note: godotenv.Load does NOT override existing environment variables - the first file that sets a variable wins. Non-existent files are silently skipped.
func MustLoadDotEnv ¶
MustLoadDotEnv loads environment variables from a .env file. Unlike LoadDotEnv, it returns an error if the file does not exist.
func OverloadDotEnvFromFiles ¶
OverloadDotEnvFromFiles loads environment variables from multiple .env files, overwriting any existing values. Files are processed in order, with later files overwriting earlier values. Non-existent files are silently skipped.
func ParseAPIKeys ¶
ParseAPIKeys parses a comma-separated string of API keys.
func PrepareCloneDir ¶
PrepareCloneDir resolves the clone directory (defaulting if empty) and creates it.
func PrepareDataDir ¶
PrepareDataDir creates the data directory if it does not exist and returns it.
Types ¶
type AppConfig ¶
type AppConfig struct {
// contains filtered or unexported fields
}
AppConfig holds the main application configuration.
func LoadConfig ¶
LoadConfig loads configuration from a .env file (optional) and environment variables. The .env file is loaded first if it exists, then environment variables override. This matches Python's pydantic-settings behavior.
func NewAppConfig ¶
func NewAppConfig() AppConfig
NewAppConfig creates a new AppConfig with defaults.
func NewAppConfigWithOptions ¶
func NewAppConfigWithOptions(opts ...AppConfigOption) AppConfig
NewAppConfigWithOptions creates an AppConfig with functional options.
func (AppConfig) Apply ¶
func (c AppConfig) Apply(opts ...AppConfigOption) AppConfig
Apply returns a new AppConfig with the given options applied. This copies all fields from the receiver and then applies the options, making it safe to use when adding new fields to AppConfig.
func (AppConfig) ChunkMinSize ¶
ChunkMinSize returns the minimum chunk size in characters.
func (AppConfig) ChunkOverlap ¶
ChunkOverlap returns the overlap between adjacent chunks in characters.
func (AppConfig) DisableTelemetry ¶
DisableTelemetry returns whether telemetry is disabled.
func (AppConfig) EmbeddingEndpoint ¶
EmbeddingEndpoint returns the embedding endpoint config.
func (AppConfig) EnrichmentEndpoint ¶
EnrichmentEndpoint returns the enrichment endpoint config.
func (AppConfig) EnsureCloneDir ¶
EnsureCloneDir creates the clone directory if it doesn't exist.
func (AppConfig) EnsureDataDir ¶
EnsureDataDir creates the data directory if it doesn't exist.
func (AppConfig) EnsureLiteLLMCacheDir ¶
EnsureLiteLLMCacheDir creates the LiteLLM cache directory if it doesn't exist.
func (AppConfig) HTTPCacheDir ¶
HTTPCacheDir returns the HTTP response cache directory, or empty if disabled.
func (AppConfig) LiteLLMCache ¶
func (c AppConfig) LiteLLMCache() LiteLLMCacheConfig
LiteLLMCache returns the LiteLLM cache config.
func (AppConfig) LiteLLMCacheDir ¶
LiteLLMCacheDir returns the LiteLLM cache directory path.
func (AppConfig) LogAttrs ¶
LogAttrs returns slog attributes for logging the configuration. Sensitive values like API keys are masked or shown as counts.
func (AppConfig) PeriodicSync ¶
func (c AppConfig) PeriodicSync() PeriodicSyncConfig
PeriodicSync returns the periodic sync config.
func (AppConfig) Remote ¶
func (c AppConfig) Remote() RemoteConfig
Remote returns the remote config.
func (AppConfig) Reporting ¶
func (c AppConfig) Reporting() ReportingConfig
Reporting returns the reporting config.
func (AppConfig) SearchLimit ¶
SearchLimit returns the default search result limit.
func (AppConfig) SimpleChunking ¶
SimpleChunking returns whether fixed-size text chunking is enabled.
func (AppConfig) SkipProviderValidation ¶
SkipProviderValidation returns whether to skip provider validation at startup. This is intended for testing only.
func (AppConfig) WorkerCount ¶
WorkerCount returns the number of background workers.
type AppConfigOption ¶
type AppConfigOption func(*AppConfig)
AppConfigOption is a functional option for AppConfig.
func WithChunkMinSize ¶
func WithChunkMinSize(minSize int) AppConfigOption
WithChunkMinSize sets the minimum chunk size in characters.
func WithChunkOverlap ¶
func WithChunkOverlap(overlap int) AppConfigOption
WithChunkOverlap sets the overlap between adjacent chunks in characters.
func WithChunkSize ¶
func WithChunkSize(size int) AppConfigOption
WithChunkSize sets the target chunk size in characters.
func WithDataDir ¶
func WithDataDir(dir string) AppConfigOption
WithDataDir sets the data directory.
func WithDisableTelemetry ¶
func WithDisableTelemetry(disabled bool) AppConfigOption
WithDisableTelemetry sets telemetry state.
func WithEmbeddingEndpoint ¶
func WithEmbeddingEndpoint(e Endpoint) AppConfigOption
WithEmbeddingEndpoint sets the embedding endpoint.
func WithEnrichmentEndpoint ¶
func WithEnrichmentEndpoint(e Endpoint) AppConfigOption
WithEnrichmentEndpoint sets the enrichment endpoint.
func WithHTTPCacheDir ¶
func WithHTTPCacheDir(dir string) AppConfigOption
WithHTTPCacheDir sets the HTTP response cache directory.
func WithLiteLLMCacheConfig ¶
func WithLiteLLMCacheConfig(l LiteLLMCacheConfig) AppConfigOption
WithLiteLLMCacheConfig sets the LiteLLM cache config.
func WithLogFormat ¶
func WithLogFormat(format LogFormat) AppConfigOption
WithLogFormat sets the log format.
func WithLogLevel ¶
func WithLogLevel(level string) AppConfigOption
WithLogLevel sets the log level.
func WithPeriodicSyncConfig ¶
func WithPeriodicSyncConfig(p PeriodicSyncConfig) AppConfigOption
WithPeriodicSyncConfig sets the periodic sync config.
func WithRemoteConfig ¶
func WithRemoteConfig(r RemoteConfig) AppConfigOption
WithRemoteConfig sets the remote config.
func WithReportingConfig ¶
func WithReportingConfig(r ReportingConfig) AppConfigOption
WithReportingConfig sets the reporting config.
func WithSearchLimit ¶
func WithSearchLimit(n int) AppConfigOption
WithSearchLimit sets the default search result limit.
func WithSimpleChunking ¶
func WithSimpleChunking(enabled bool) AppConfigOption
WithSimpleChunking enables or disables fixed-size text chunking.
func WithSkipProviderValidation ¶
func WithSkipProviderValidation(skip bool) AppConfigOption
WithSkipProviderValidation sets whether to skip provider validation. WARNING: For testing only. Kodit requires providers for full functionality.
func WithWorkerCount ¶
func WithWorkerCount(n int) AppConfigOption
WithWorkerCount sets the number of background workers.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint configures an AI service endpoint.
func NewEndpointWithOptions ¶
func NewEndpointWithOptions(opts ...EndpointOption) Endpoint
NewEndpointWithOptions creates an Endpoint with functional options.
func (Endpoint) BackoffFactor ¶
BackoffFactor returns the retry backoff multiplier.
func (Endpoint) ExtraParams ¶
ExtraParams returns additional provider-specific parameters.
func (Endpoint) InitialDelay ¶
InitialDelay returns the initial retry delay.
func (Endpoint) IsConfigured ¶
IsConfigured returns true if the endpoint has required configuration.
func (Endpoint) MaxBatchChars ¶
MaxBatchChars returns the maximum total characters per embedding batch.
func (Endpoint) MaxBatchSize ¶
MaxBatchSize returns the maximum number of requests per batch.
func (Endpoint) MaxRetries ¶
MaxRetries returns the maximum retry count.
func (Endpoint) NumParallelTasks ¶
NumParallelTasks returns the number of parallel tasks.
func (Endpoint) SocketPath ¶
SocketPath returns the Unix socket path.
type EndpointEnv ¶
type EndpointEnv struct {
// BaseURL is the base URL for the endpoint.
// Env: *_BASE_URL
BaseURL string `envconfig:"BASE_URL"`
// Model is the model identifier (e.g., openai/text-embedding-3-small).
// Env: *_MODEL
Model string `envconfig:"MODEL"`
// APIKey is the API key for authentication.
// Env: *_API_KEY
APIKey string `envconfig:"API_KEY"`
// NumParallelTasks is the number of parallel tasks.
// Env: *_NUM_PARALLEL_TASKS (default: 1)
NumParallelTasks int `envconfig:"NUM_PARALLEL_TASKS" default:"1"`
// SocketPath is the Unix socket path for local communication.
// Env: *_SOCKET_PATH
SocketPath string `envconfig:"SOCKET_PATH"`
// Timeout is the request timeout in seconds.
// Env: *_TIMEOUT (default: 60)
Timeout float64 `envconfig:"TIMEOUT" default:"60"`
// MaxRetries is the maximum number of retries.
// Env: *_MAX_RETRIES (default: 5)
MaxRetries int `envconfig:"MAX_RETRIES" default:"5"`
// InitialDelay is the initial retry delay in seconds.
// Env: *_INITIAL_DELAY (default: 2.0)
InitialDelay float64 `envconfig:"INITIAL_DELAY" default:"2.0"`
// BackoffFactor is the retry backoff multiplier.
// Env: *_BACKOFF_FACTOR (default: 2.0)
BackoffFactor float64 `envconfig:"BACKOFF_FACTOR" default:"2.0"`
// ExtraParams is a JSON-encoded map of extra parameters.
// Env: *_EXTRA_PARAMS
ExtraParams string `envconfig:"EXTRA_PARAMS"`
// MaxTokens is the maximum token limit.
// Env: *_MAX_TOKENS (default: 4000)
MaxTokens int `envconfig:"MAX_TOKENS" default:"4000"`
// MaxBatchChars is the maximum total characters per embedding batch.
// Env: *_MAX_BATCH_CHARS (default: 16000)
MaxBatchChars int `envconfig:"MAX_BATCH_CHARS" default:"16000"`
// MaxBatchSize is the maximum number of requests per batch.
// Env: *_MAX_BATCH_SIZE (default: 1)
MaxBatchSize int `envconfig:"MAX_BATCH_SIZE" default:"1"`
}
EndpointEnv holds environment configuration for an AI endpoint.
func (EndpointEnv) IsConfigured ¶
func (e EndpointEnv) IsConfigured() bool
IsConfigured returns true if the endpoint has a model configured.
func (EndpointEnv) ToEndpoint ¶
func (e EndpointEnv) ToEndpoint() Endpoint
ToEndpoint converts EndpointEnv to Endpoint.
type EndpointOption ¶
type EndpointOption func(*Endpoint)
EndpointOption is a functional option for Endpoint.
func WithBackoffFactor ¶
func WithBackoffFactor(f float64) EndpointOption
WithBackoffFactor sets the retry backoff multiplier.
func WithExtraParams ¶
func WithExtraParams(params map[string]any) EndpointOption
WithExtraParams sets extra provider parameters.
func WithInitialDelay ¶
func WithInitialDelay(d time.Duration) EndpointOption
WithInitialDelay sets the initial retry delay.
func WithMaxBatchChars ¶
func WithMaxBatchChars(n int) EndpointOption
WithMaxBatchChars sets the maximum total characters per embedding batch.
func WithMaxBatchSize ¶
func WithMaxBatchSize(n int) EndpointOption
WithMaxBatchSize sets the maximum number of requests per batch.
func WithMaxRetries ¶
func WithMaxRetries(n int) EndpointOption
WithMaxRetries sets the maximum retry count.
func WithMaxTokens ¶
func WithMaxTokens(n int) EndpointOption
WithMaxTokens sets the maximum token limit.
func WithNumParallelTasks ¶
func WithNumParallelTasks(n int) EndpointOption
WithNumParallelTasks sets the parallel task count.
func WithSocketPath ¶
func WithSocketPath(path string) EndpointOption
WithSocketPath sets the Unix socket path.
func WithTimeout ¶
func WithTimeout(d time.Duration) EndpointOption
WithTimeout sets the request timeout.
type EnvConfig ¶
type EnvConfig struct {
// Host is the server host to bind to.
// Env: HOST (default: 0.0.0.0)
Host string `envconfig:"HOST" default:"0.0.0.0"`
// Port is the server port to listen on.
// Env: PORT (default: 8080)
Port int `envconfig:"PORT" default:"8080"`
// DataDir is the data directory path.
// Env: DATA_DIR
// Default: ~/.kodit
DataDir string `envconfig:"DATA_DIR"`
// DBURL is the database connection URL.
// Env: DB_URL
// Default: sqlite:///{data_dir}/kodit.db
DBURL string `envconfig:"DB_URL"`
// LogLevel is the log verbosity level.
// Env: LOG_LEVEL (default: INFO)
LogLevel string `envconfig:"LOG_LEVEL" default:"INFO"`
// LogFormat is the log output format (pretty or json).
// Env: LOG_FORMAT (default: pretty)
LogFormat string `envconfig:"LOG_FORMAT" default:"pretty"`
// DisableTelemetry controls telemetry collection.
// Env: DISABLE_TELEMETRY (default: false)
DisableTelemetry bool `envconfig:"DISABLE_TELEMETRY" default:"false"`
// SkipProviderValidation skips provider requirement validation at startup.
// Env: SKIP_PROVIDER_VALIDATION (default: false)
// WARNING: For testing only. Kodit requires providers for full functionality.
SkipProviderValidation bool `envconfig:"SKIP_PROVIDER_VALIDATION" default:"false"`
// APIKeys is a comma-separated list of valid API keys.
// Env: API_KEYS
APIKeys string `envconfig:"API_KEYS"`
// EmbeddingEndpoint configures the embedding AI service.
EmbeddingEndpoint EndpointEnv `envconfig:"EMBEDDING_ENDPOINT"`
// EnrichmentEndpoint configures the enrichment AI service.
EnrichmentEndpoint EndpointEnv `envconfig:"ENRICHMENT_ENDPOINT"`
// PeriodicSync configures periodic repository syncing.
PeriodicSync PeriodicSyncEnv `envconfig:"PERIODIC_SYNC"`
// Remote configures remote server connection.
Remote RemoteEnv `envconfig:"REMOTE"`
// Reporting configures progress reporting.
Reporting ReportingEnv `envconfig:"REPORTING"`
// LiteLLMCache configures LLM response caching.
LiteLLMCache LiteLLMCacheEnv `envconfig:"LITELLM_CACHE"`
// WorkerCount is the number of background workers.
// Env: WORKER_COUNT (default: 1)
WorkerCount int `envconfig:"WORKER_COUNT" default:"1"`
// SearchLimit is the default search result limit.
// Env: SEARCH_LIMIT (default: 10)
SearchLimit int `envconfig:"SEARCH_LIMIT" default:"10"`
// HTTPCacheDir is the directory for caching HTTP responses to disk.
// When set, POST request/response pairs are cached to avoid repeated API calls.
// Env: HTTP_CACHE_DIR
HTTPCacheDir string `envconfig:"HTTP_CACHE_DIR"`
// SimpleChunking enables fixed-size text chunking instead of AST-based snippet extraction.
// Env: SIMPLE_CHUNKING_ENABLED (default: true)
SimpleChunking bool `envconfig:"SIMPLE_CHUNKING_ENABLED" default:"true"`
// ChunkSize is the target size in characters for each text chunk.
// Env: CHUNK_SIZE (default: 1500)
ChunkSize int `envconfig:"CHUNK_SIZE" default:"1500"`
// ChunkOverlap is the number of overlapping characters between adjacent chunks.
// Env: CHUNK_OVERLAP (default: 200)
ChunkOverlap int `envconfig:"CHUNK_OVERLAP" default:"200"`
// ChunkMinSize is the minimum chunk size in characters; smaller chunks are dropped.
// Env: CHUNK_MIN_SIZE (default: 50)
ChunkMinSize int `envconfig:"CHUNK_MIN_SIZE" default:"50"`
}
EnvConfig holds all environment-based configuration. Field names map to environment variables with KODIT_ prefix removed. Nested structs use underscore delimiter (e.g., EMBEDDING_ENDPOINT_BASE_URL).
func LoadFromEnv ¶
LoadFromEnv loads configuration from environment variables. It uses no prefix, matching the Python pydantic-settings behavior.
func LoadFromEnvWithPrefix ¶
LoadFromEnvWithPrefix loads configuration with a custom prefix. For example, prefix "KODIT" would require KODIT_DATA_DIR instead of DATA_DIR.
func (EnvConfig) Normalize ¶
Normalize returns a copy of the EnvConfig with legacy Python-format values converted to their Go equivalents. It logs warnings for each transformation so users know to update their .env files.
func (EnvConfig) ToAppConfig ¶
ToAppConfig converts EnvConfig to AppConfig.
type LiteLLMCacheConfig ¶
type LiteLLMCacheConfig struct {
// contains filtered or unexported fields
}
LiteLLMCacheConfig configures LLM response caching.
func NewLiteLLMCacheConfig ¶
func NewLiteLLMCacheConfig() LiteLLMCacheConfig
NewLiteLLMCacheConfig creates a new LiteLLMCacheConfig with defaults.
func (LiteLLMCacheConfig) Enabled ¶
func (c LiteLLMCacheConfig) Enabled() bool
Enabled returns whether caching is enabled.
func (LiteLLMCacheConfig) WithEnabled ¶
func (c LiteLLMCacheConfig) WithEnabled(enabled bool) LiteLLMCacheConfig
WithEnabled returns a new config with the specified enabled state.
type LiteLLMCacheEnv ¶
type LiteLLMCacheEnv struct {
// Enabled controls whether caching is enabled.
// Env: LITELLM_CACHE_ENABLED (default: true)
Enabled bool `envconfig:"ENABLED" default:"true"`
}
LiteLLMCacheEnv holds environment configuration for LLM caching.
func (LiteLLMCacheEnv) ToLiteLLMCacheConfig ¶
func (l LiteLLMCacheEnv) ToLiteLLMCacheConfig() LiteLLMCacheConfig
ToLiteLLMCacheConfig converts LiteLLMCacheEnv to LiteLLMCacheConfig.
type PeriodicSyncConfig ¶
type PeriodicSyncConfig struct {
// contains filtered or unexported fields
}
PeriodicSyncConfig configures periodic repository syncing.
func NewPeriodicSyncConfig ¶
func NewPeriodicSyncConfig() PeriodicSyncConfig
NewPeriodicSyncConfig creates a new PeriodicSyncConfig with defaults.
func (PeriodicSyncConfig) CheckInterval ¶
func (p PeriodicSyncConfig) CheckInterval() time.Duration
CheckInterval returns how often to check for repositories due for sync.
func (PeriodicSyncConfig) Enabled ¶
func (p PeriodicSyncConfig) Enabled() bool
Enabled returns whether periodic sync is enabled.
func (PeriodicSyncConfig) Interval ¶
func (p PeriodicSyncConfig) Interval() time.Duration
Interval returns the sync interval as a duration.
func (PeriodicSyncConfig) RetryAttempts ¶
func (p PeriodicSyncConfig) RetryAttempts() int
RetryAttempts returns the retry count.
func (PeriodicSyncConfig) WithCheckIntervalSeconds ¶
func (p PeriodicSyncConfig) WithCheckIntervalSeconds(seconds float64) PeriodicSyncConfig
WithCheckIntervalSeconds returns a new config with the specified check interval.
func (PeriodicSyncConfig) WithEnabled ¶
func (p PeriodicSyncConfig) WithEnabled(enabled bool) PeriodicSyncConfig
WithEnabled returns a new config with the specified enabled state.
func (PeriodicSyncConfig) WithIntervalSeconds ¶
func (p PeriodicSyncConfig) WithIntervalSeconds(seconds float64) PeriodicSyncConfig
WithIntervalSeconds returns a new config with the specified interval.
func (PeriodicSyncConfig) WithRetryAttempts ¶
func (p PeriodicSyncConfig) WithRetryAttempts(attempts int) PeriodicSyncConfig
WithRetryAttempts returns a new config with the specified retry count.
type PeriodicSyncEnv ¶
type PeriodicSyncEnv struct {
// Enabled controls whether periodic sync is enabled.
// Env: PERIODIC_SYNC_ENABLED (default: true)
Enabled bool `envconfig:"ENABLED" default:"true"`
// IntervalSeconds is the sync interval in seconds.
// Env: PERIODIC_SYNC_INTERVAL_SECONDS (default: 1800)
IntervalSeconds float64 `envconfig:"INTERVAL_SECONDS" default:"1800"`
// RetryAttempts is the number of retry attempts.
// Env: PERIODIC_SYNC_RETRY_ATTEMPTS (default: 3)
RetryAttempts int `envconfig:"RETRY_ATTEMPTS" default:"3"`
}
PeriodicSyncEnv holds environment configuration for periodic sync.
func (PeriodicSyncEnv) ToPeriodicSyncConfig ¶
func (p PeriodicSyncEnv) ToPeriodicSyncConfig() PeriodicSyncConfig
ToPeriodicSyncConfig converts PeriodicSyncEnv to PeriodicSyncConfig.
type RemoteConfig ¶
type RemoteConfig struct {
// contains filtered or unexported fields
}
RemoteConfig configures remote server connection.
func NewRemoteConfig ¶
func NewRemoteConfig() RemoteConfig
NewRemoteConfig creates a new RemoteConfig with defaults.
func NewRemoteConfigWithOptions ¶
func NewRemoteConfigWithOptions(opts ...RemoteConfigOption) RemoteConfig
NewRemoteConfigWithOptions creates a RemoteConfig with options.
func (RemoteConfig) IsConfigured ¶
func (r RemoteConfig) IsConfigured() bool
IsConfigured returns true if remote mode is configured.
func (RemoteConfig) MaxRetries ¶
func (r RemoteConfig) MaxRetries() int
MaxRetries returns the maximum retry count.
func (RemoteConfig) ServerURL ¶
func (r RemoteConfig) ServerURL() string
ServerURL returns the remote server URL.
func (RemoteConfig) Timeout ¶
func (r RemoteConfig) Timeout() time.Duration
Timeout returns the request timeout.
func (RemoteConfig) VerifySSL ¶
func (r RemoteConfig) VerifySSL() bool
VerifySSL returns whether SSL verification is enabled.
type RemoteConfigOption ¶
type RemoteConfigOption func(*RemoteConfig)
RemoteConfigOption is a functional option for RemoteConfig.
func WithRemoteAPIKey ¶
func WithRemoteAPIKey(key string) RemoteConfigOption
WithRemoteAPIKey sets the API key.
func WithRemoteMaxRetries ¶
func WithRemoteMaxRetries(n int) RemoteConfigOption
WithRemoteMaxRetries sets the max retries.
func WithRemoteTimeout ¶
func WithRemoteTimeout(d time.Duration) RemoteConfigOption
WithRemoteTimeout sets the timeout.
func WithServerURL ¶
func WithServerURL(url string) RemoteConfigOption
WithServerURL sets the server URL.
func WithVerifySSL ¶
func WithVerifySSL(verify bool) RemoteConfigOption
WithVerifySSL sets SSL verification.
type RemoteEnv ¶
type RemoteEnv struct {
// ServerURL is the remote server URL.
// Env: REMOTE_SERVER_URL
ServerURL string `envconfig:"SERVER_URL"`
// APIKey is the API key for authentication.
// Env: REMOTE_API_KEY
APIKey string `envconfig:"API_KEY"`
// Timeout is the request timeout in seconds.
// Env: REMOTE_TIMEOUT (default: 30)
Timeout float64 `envconfig:"TIMEOUT" default:"30"`
// MaxRetries is the maximum retry attempts.
// Env: REMOTE_MAX_RETRIES (default: 3)
MaxRetries int `envconfig:"MAX_RETRIES" default:"3"`
// VerifySSL controls SSL certificate verification.
// Env: REMOTE_VERIFY_SSL (default: true)
VerifySSL bool `envconfig:"VERIFY_SSL" default:"true"`
}
RemoteEnv holds environment configuration for remote server.
func (RemoteEnv) IsConfigured ¶
IsConfigured returns true if remote server URL is configured.
func (RemoteEnv) ToRemoteConfig ¶
func (r RemoteEnv) ToRemoteConfig() RemoteConfig
ToRemoteConfig converts RemoteEnv to RemoteConfig.
type ReportingConfig ¶
type ReportingConfig struct {
// contains filtered or unexported fields
}
ReportingConfig configures progress reporting.
func NewReportingConfig ¶
func NewReportingConfig() ReportingConfig
NewReportingConfig creates a new ReportingConfig with defaults.
func (ReportingConfig) LogTimeInterval ¶
func (r ReportingConfig) LogTimeInterval() time.Duration
LogTimeInterval returns the time interval for logging progress.
func (ReportingConfig) WithLogTimeInterval ¶
func (r ReportingConfig) WithLogTimeInterval(d time.Duration) ReportingConfig
WithLogTimeInterval returns a new config with the specified interval.
type ReportingEnv ¶
type ReportingEnv struct {
// LogTimeInterval is the logging interval in seconds.
// Env: REPORTING_LOG_TIME_INTERVAL (default: 5)
LogTimeInterval float64 `envconfig:"LOG_TIME_INTERVAL" default:"5"`
}
ReportingEnv holds environment configuration for reporting.
func (ReportingEnv) ToReportingConfig ¶
func (r ReportingEnv) ToReportingConfig() ReportingConfig
ToReportingConfig converts ReportingEnv to ReportingConfig.