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"
Shards *bool `yaml:"shards,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) RequireAPIKey ¶
RequireAPIKey returns an actionable error if no API key is configured.
func (*Config) Save ¶
Save writes the config to disk, creating the directory if necessary. The file is written with mode 0600 (owner-readable only). Uses a tmp→rename pattern so a partial write (e.g. killed process) can never leave a corrupt config file.
func (*Config) ShardsEnabled ¶ added in v0.4.1
ShardsEnabled reports whether shard mode is on. Defaults to true.