config

package
v0.0.0-...-7517a86 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TranslationProviders = []string{"auto", "google", "llm", "none"}

Functions

func Dir

func Dir() string

func Exists

func Exists() bool

func Path

func Path() string

func Save

func Save(c *Config) error

func WriteFile

func WriteFile(path string, data []byte) error

WriteFile writes atomically with 0600: files here may hold api keys.

Types

type Config

type Config struct {
	Language            string     `mapstructure:"language" yaml:"language"`
	ShowOriginal        bool       `mapstructure:"show_original" yaml:"show_original"`
	TranslationProvider string     `mapstructure:"translation_provider" yaml:"translation_provider"`
	ActiveProvider      string     `mapstructure:"active_provider" yaml:"active_provider"`
	Providers           []Provider `mapstructure:"providers" yaml:"providers"`
	Releases            []string   `mapstructure:"releases" yaml:"releases"`
	ExtraFeeds          []Feed     `mapstructure:"extra_feeds" yaml:"extra_feeds"`
	DisabledCategories  []string   `mapstructure:"disabled_categories" yaml:"disabled_categories"`
	Location            Location   `mapstructure:"location" yaml:"location"`
	TempUnit            string     `mapstructure:"temp_unit" yaml:"temp_unit"`
	RefreshSec          int        `mapstructure:"refresh_seconds" yaml:"refresh_seconds"`
	DigestCacheMins     int        `mapstructure:"digest_cache_minutes" yaml:"digest_cache_minutes"`
	CacheMaxEntries     int        `mapstructure:"cache_max_entries" yaml:"cache_max_entries"`
}

func Default

func Default() *Config

func Load

func Load() (*Config, error)

Load returns defaults when there is no config file yet.

func (*Config) Active

func (c *Config) Active() *Provider

Active returns the selected LLM provider, or nil in FREE mode.

func (*Config) CategoryEnabled

func (c *Config) CategoryEnabled(cat string) bool

func (*Config) NextProvider

func (c *Config) NextProvider()

NextProvider cycles: none -> each usable provider -> none.

type Feed

type Feed struct {
	Name     string `mapstructure:"name" yaml:"name"`
	URL      string `mapstructure:"url" yaml:"url"`
	Category string `mapstructure:"category" yaml:"category"`
	Lang     string `mapstructure:"lang" yaml:"lang"`
}

type Location

type Location struct {
	City      string  `mapstructure:"city" yaml:"city"`
	Country   string  `mapstructure:"country" yaml:"country"`
	Latitude  float64 `mapstructure:"latitude" yaml:"latitude"`
	Longitude float64 `mapstructure:"longitude" yaml:"longitude"`
}

type Provider

type Provider struct {
	Name      string `mapstructure:"name" yaml:"name"`
	Type      string `mapstructure:"type" yaml:"type"`
	BaseURL   string `mapstructure:"base_url" yaml:"base_url"`
	Model     string `mapstructure:"model" yaml:"model"`
	APIKey    string `mapstructure:"api_key" yaml:"api_key,omitempty"`
	APIKeyEnv string `mapstructure:"api_key_env" yaml:"api_key_env,omitempty"`
}

Provider is an LLM endpoint. Type is "openai" (any compatible API, incl. Groq and Ollama) or "gemini".

func (Provider) Key

func (p Provider) Key() string

func (Provider) Usable

func (p Provider) Usable() bool

Usable: has a key, or is local and needs none.

Jump to

Keyboard shortcuts

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