Documentation
¶
Overview ¶
Package config manages the user's Supermodel configuration stored at ~/.supermodel/config.yaml. It handles loading, saving, and validating config values such as the API key, default output format, and API base URL.
This is a shared kernel package. It must contain no business logic. Slice packages under internal/ may import it freely.
Index ¶
Constants ¶
const DefaultAPIBase = "https://api.supermodeltools.com"
DefaultAPIBase is the production Supermodel API endpoint.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
APIKey string `yaml:"api_key,omitempty"`
APIBase string `yaml:"api_base,omitempty"`
Output string `yaml:"output,omitempty"` // "human" | "json"
Files *bool `yaml:"files,omitempty"`
}
Config holds user-level settings persisted at ~/.supermodel/config.yaml.
func Load ¶
Load reads the config file. Returns defaults when the file does not exist. Environment variables override file values:
- SUPERMODEL_API_KEY overrides api_key
- SUPERMODEL_API_BASE overrides api_base
func (*Config) FilesEnabled ¶ added in v0.4.0
FilesEnabled reports whether file mode is on. Defaults to true.
func (*Config) RequireAPIKey ¶
RequireAPIKey returns an actionable error if no API key is configured.