config

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigDirPerm is the permission for the config directory (0700 = rwx------)
	// Restrictive permissions protect the directory from being accessed by other users
	ConfigDirPerm os.FileMode = 0700
	// ConfigFilePerm is the permission for the config file (0600 = rw-------)
	// Restrictive permissions protect the API key from being read by other users
	ConfigFilePerm os.FileMode = 0600
)

Variables

This section is empty.

Functions

func Get

func Get(key string) interface{}

func Save

func Save(cfg *Config) error

func Set

func Set(key, value string) error

Types

type Config

type Config struct {
	Provider              string `mapstructure:"provider"`          // "openai" or "anthropic"
	APIKey                string `mapstructure:"api_key"`           // OpenAI API key (backward compatible)
	AnthropicAPIKey       string `mapstructure:"anthropic_api_key"` // Anthropic API key
	Model                 string `mapstructure:"model"`
	ShowDiff              bool   `mapstructure:"show_diff"`
	AutoCopy              bool   `mapstructure:"auto_copy"`
	Style                 string `mapstructure:"style"`
	Language              string `mapstructure:"language"`
	TranslationLanguage   string `mapstructure:"translation_language"`
	CacheEnabled          bool   `mapstructure:"cache_enabled"`
	CacheTTLDays          int    `mapstructure:"cache_ttl_days"`
	RateLimitEnabled      bool   `mapstructure:"rate_limit_enabled"`
	RateLimitRequests     int    `mapstructure:"rate_limit_requests"`
	RateLimitWindow       int    `mapstructure:"rate_limit_window_seconds"`
	RequestTimeoutSeconds int    `mapstructure:"request_timeout_seconds"`
}

func Load

func Load() (*Config, error)

func (*Config) GetAPIKey added in v1.0.4

func (c *Config) GetAPIKey() string

GetAPIKey returns the appropriate API key based on the provider

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL