Documentation
¶
Overview ¶
Package config handles application configuration from environment variables
Index ¶
Constants ¶
const ( EnvAPIKey = "ANTHROPIC_API_KEY" EnvBaseURL = "ANTHROPIC_BASE_URL" EnvOpusModel = "ANTHROPIC_DEFAULT_OPUS_MODEL" EnvSonnetModel = "ANTHROPIC_DEFAULT_SONNET_MODEL" EnvHaikuModel = "ANTHROPIC_DEFAULT_HAIKU_MODEL" EnvMaxTokens = "CLAUDE_CODE_MAX_OUTPUT_TOKENS" )
Environment variable names
Variables ¶
This section is empty.
Functions ¶
func ConfigFilePath ¶
func ConfigFilePath() string
ConfigFilePath returns the path to the user's config file, respecting XDG_CONFIG_HOME.
func LoadConfigFile ¶
LoadConfigFile reads the config file at path and returns its key-value pairs. If the file does not exist, an empty map is returned without error.
func LoadSystemPromptFile ¶
LoadSystemPromptFile reads a markdown file and returns its content as a string. If the file does not exist, it returns an empty string and no error.
Types ¶
type Config ¶
type Config struct {
APIKey string
BaseURL string
OpusModel string
SonnetModel string
HaikuModel string
MaxTokens int // 0 means use the API client's default
}
Config holds the application configuration
func (Config) AvailableModels ¶
AvailableModels returns configured model values in priority order (opus, sonnet, haiku).
func (Config) DefaultModel ¶
DefaultModel returns the highest-priority configured model (opus > sonnet > haiku).
type Loader ¶
Loader defines the interface for loading configuration
func NewEnvLoader ¶
func NewEnvLoader() Loader
NewEnvLoader creates a loader that reads from environment variables, falling back to ~/.config/monkey/config.toml (or $XDG_CONFIG_HOME/monkey/config.toml).
func NewEnvLoaderWithConfigFile ¶
NewEnvLoaderWithConfigFile creates a loader that reads from environment variables, falling back to the specified config file path.