Documentation
¶
Index ¶
- func GetConfigPath() (string, error)
- func IsConfigured() bool
- type APIKeyConfig
- type Config
- func (c *Config) AddKey(name string, key string, baseURL string)
- func (c *Config) GetCurrentKey() (APIKeyConfig, error)
- func (c *Config) GetCurrentKeyName() string
- func (c *Config) ListKeys() []string
- func (c *Config) RemoveKey(name string) error
- func (c *Config) SaveConfig(configPath string) error
- func (c *Config) SetDefaultKey(name string) error
- func (c *Config) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigPath ¶
GetConfigPath returns the default configuration file path
func IsConfigured ¶
func IsConfigured() bool
IsConfigured checks if the CLI is configured with at least one API key
Types ¶
type APIKeyConfig ¶
type APIKeyConfig struct {
Key string `yaml:"key" json:"key"`
BaseURL string `yaml:"base_url" json:"base_url"`
Timeout int `yaml:"timeout,omitempty" json:"timeout,omitempty"` // seconds
}
APIKeyConfig represents configuration for a named API key
type Config ¶
type Config struct {
DefaultKey string `yaml:"default_key,omitempty" json:"default_key,omitempty"`
Keys map[string]APIKeyConfig `yaml:"keys" json:"keys"`
// Global settings
Verbose bool `yaml:"verbose,omitempty" json:"verbose,omitempty"`
Debug bool `yaml:"debug,omitempty" json:"debug,omitempty"`
// Default values
DefaultTimeout int `yaml:"default_timeout,omitempty" json:"default_timeout,omitempty"`
DefaultBaseURL string `yaml:"default_base_url,omitempty" json:"default_base_url,omitempty"`
}
Config represents the complete CLI configuration
func LoadConfig ¶
LoadConfig loads configuration from file and environment variables
func (*Config) GetCurrentKey ¶
func (c *Config) GetCurrentKey() (APIKeyConfig, error)
GetCurrentKey returns the configuration for the currently selected API key
func (*Config) GetCurrentKeyName ¶
GetCurrentKeyName returns the name of the currently selected API key
func (*Config) SaveConfig ¶
SaveConfig saves the configuration to file
func (*Config) SetDefaultKey ¶
SetDefaultKey sets the default API key
Click to show internal directories.
Click to hide internal directories.