config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config implements lore's minimal config file, decided in https://github.com/cheetahbyte/lore/issues/3: only embeddings provider settings and per-crawled-source options live here, everything else is pure CLI args.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns $XDG_CONFIG_HOME/lore/config.toml, falling back to ~/.config/lore/config.toml, per issue #3.

func DataPath

func DataPath() (string, error)

DataPath returns $XDG_DATA_HOME/lore/index.db, falling back to ~/.local/share/lore/index.db, per issue #3.

func EnsureParentDir

func EnsureParentDir(path string) error

EnsureParentDir creates the parent directory of path if it doesn't exist.

func Save

func Save(path string, cfg *Config) error

Save writes cfg to path as TOML, creating its parent directory if needed.

Types

type Config

type Config struct {
	Embeddings Embeddings              `toml:"embeddings"`
	Sources    map[string]SourceConfig `toml:"sources"`
}

func Load

func Load(path string) (*Config, error)

Load reads and parses the config file at path. A missing file is not an error — it returns a zero-value Config, since every field has a sensible empty default (embeddings disabled, no per-source overrides).

func (*Config) EffectiveAPIKey

func (c *Config) EffectiveAPIKey() string

EffectiveAPIKey returns the embeddings API key, letting LORE_EMBEDDINGS_API_KEY override whatever's in the config file.

type Embeddings

type Embeddings struct {
	Provider string `toml:"provider"` // "" | "openai" | "ollama"
	APIKey   string `toml:"api_key"`  // LORE_EMBEDDINGS_API_KEY env var overrides this
	Endpoint string `toml:"endpoint"` // e.g. http://localhost:11434 for ollama
}

Embeddings configures the optional vector-search path decided in issue #7. Provider == "" means vector search is disabled and lore stays FTS-only.

type SourceConfig

type SourceConfig struct {
	Depth   int      `toml:"depth"`
	Include []string `toml:"include"`
	Exclude []string `toml:"exclude"`
}

SourceConfig holds per-source crawl options, keyed by the source's identity string (e.g. "url:https://docs.example.com"). Only meaningful for url: (crawled) sources, per issue #3.

Jump to

Keyboard shortcuts

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