config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles loading and saving Alaska's TOML configuration. API keys are NOT stored here — they live in the OS keyring (see internal/secrets).

Index

Constants

View Source
const (
	TypeOpenAI    = "openai"
	TypeAnthropic = "anthropic"
	TypeAlaska    = "alaska" // Alaska API — OpenAI-compatible proxy with custom base_url
)

Known provider types. Custom providers use "openai" with a base_url override.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the absolute path to config.toml for the current OS.

func Save

func Save(cfg *Config) error

Save writes config.toml with 0600 permissions, creating parent dirs as needed.

Types

type Config

type Config struct {
	DefaultProvider string                    `toml:"default_provider"`
	DefaultModel    string                    `toml:"default_model"`
	Providers       map[string]ProviderConfig `toml:"providers"`
}

func Default

func Default() *Config

func Load

func Load() (*Config, error)

Load reads config.toml. If the file doesn't exist, returns Default() with no error.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the config is coherent enough to use.

type ProviderConfig

type ProviderConfig struct {
	Type    string `toml:"type"`
	BaseURL string `toml:"base_url,omitempty"`
}

Jump to

Keyboard shortcuts

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