config

package
v0.0.0-beta.32 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProjectSlug = "_default"

DefaultProjectSlug is the slug used when no ?project= / X-Project value is supplied on a request, and when `docsiq migrate` has no explicit --into target. Locked by Phase-1 spec.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureConfig

type AzureConfig struct {
	// Shared defaults — used when chat/embed-specific values are not set.
	Endpoint   string `mapstructure:"endpoint"`
	APIKey     string `mapstructure:"api_key"`
	APIVersion string `mapstructure:"api_version"`

	Chat  AzureServiceConfig `mapstructure:"chat"`
	Embed AzureServiceConfig `mapstructure:"embed"`
}

AzureConfig supports shared defaults with per-service overrides. Top-level fields (endpoint, api_key, api_version) are shared defaults. Chat/Embed sub-configs override specific fields when set.

Env vars (prefix DOCSIQ — legacy DOCSCONTEXT_* is still accepted as a deprecated alias and rewritten to DOCSIQ_* at Load() time):

DOCSIQ_LLM_AZURE_ENDPOINT       — shared endpoint
DOCSIQ_LLM_AZURE_API_KEY        — shared API key
DOCSIQ_LLM_AZURE_API_VERSION    — shared API version
DOCSIQ_LLM_AZURE_CHAT_ENDPOINT  — chat-specific endpoint
DOCSIQ_LLM_AZURE_CHAT_API_KEY   — chat-specific API key
DOCSIQ_LLM_AZURE_CHAT_MODEL     — chat model name
DOCSIQ_LLM_AZURE_EMBED_ENDPOINT — embedding-specific endpoint
DOCSIQ_LLM_AZURE_EMBED_API_KEY  — embedding-specific API key
DOCSIQ_LLM_AZURE_EMBED_MODEL    — embedding model name

func (*AzureConfig) ChatAPIKey

func (a *AzureConfig) ChatAPIKey() string

func (*AzureConfig) ChatAPIVersion

func (a *AzureConfig) ChatAPIVersion() string

func (*AzureConfig) ChatEndpoint

func (a *AzureConfig) ChatEndpoint() string

func (*AzureConfig) ChatModel

func (a *AzureConfig) ChatModel() string

func (*AzureConfig) EmbedAPIKey

func (a *AzureConfig) EmbedAPIKey() string

func (*AzureConfig) EmbedAPIVersion

func (a *AzureConfig) EmbedAPIVersion() string

func (*AzureConfig) EmbedEndpoint

func (a *AzureConfig) EmbedEndpoint() string

func (*AzureConfig) EmbedModel

func (a *AzureConfig) EmbedModel() string

type AzureServiceConfig

type AzureServiceConfig struct {
	Endpoint   string `mapstructure:"endpoint"`
	APIKey     string `mapstructure:"api_key"`
	APIVersion string `mapstructure:"api_version"`
	Model      string `mapstructure:"model"`
}

type CommunityConfig

type CommunityConfig struct {
	MinCommunitySize int `mapstructure:"min_community_size"`
	MaxLevels        int `mapstructure:"max_levels"`
}

type Config

type Config struct {
	DataDir        string          `mapstructure:"data_dir"`
	DefaultProject string          `mapstructure:"default_project"`
	LLM            LLMConfig       `mapstructure:"llm"`
	Indexing       IndexingConfig  `mapstructure:"indexing"`
	Community      CommunityConfig `mapstructure:"community"`
	Server         ServerConfig    `mapstructure:"server"`

	// Phase-5: per-project LLM overrides. Keyed by project slug.
	// When a slug is missing from the map, callers fall back to the
	// top-level LLM field. Not bound to env vars — configure via
	// YAML only (env flat-string rewriting doesn't nest well).
	LLMOverrides map[string]LLMConfig `mapstructure:"llm_overrides"`
}

func Load

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

func (*Config) DBPath

func (c *Config) DBPath() string

DBPath returns the legacy single-DB path ($DATA_DIR/DocsContext.db). Kept for backwards-compatibility with pre-Phase-1 code paths; new per-project code should use ProjectDBPath instead.

func (*Config) LLMConfigForProject

func (c *Config) LLMConfigForProject(slug string) LLMConfig

LLMConfigForProject returns the override for slug if present, otherwise the root LLM config. A missing or empty slug yields the root config. The Provider field is treated as the presence sentinel — a YAML block with no `provider:` key leaves Provider empty, so we treat that as "no override declared" and fall back to the root.

func (*Config) NotesDir

func (c *Config) NotesDir(slug string) string

NotesDir returns the per-project notes directory: $DATA_DIR/projects/<slug>/notes. Callers that actually intend to read or write notes should use os.MkdirAll on this path first — the config helper does not touch the filesystem.

func (*Config) ProjectDBPath

func (c *Config) ProjectDBPath(slug string) string

ProjectDBPath returns the per-project SQLite path for the given slug: $DATA_DIR/projects/<slug>/docscontext.db. Does NOT validate the slug — callers should use project.IsValidSlug or store.OpenForProject (which performs the check) when the slug came from untrusted input.

type IndexingConfig

type IndexingConfig struct {
	ChunkSize     int  `mapstructure:"chunk_size"`
	ChunkOverlap  int  `mapstructure:"chunk_overlap"`
	BatchSize     int  `mapstructure:"batch_size"`
	Workers       int  `mapstructure:"workers"`
	ExtractGraph  bool `mapstructure:"extract_graph"`
	ExtractClaims bool `mapstructure:"extract_claims"`
	MaxGleanings  int  `mapstructure:"max_gleanings"`
}

type LLMConfig

type LLMConfig struct {
	Provider string       `mapstructure:"provider"`
	Azure    AzureConfig  `mapstructure:"azure"`
	Ollama   OllamaConfig `mapstructure:"ollama"`
}

type OllamaConfig

type OllamaConfig struct {
	BaseURL    string `mapstructure:"base_url"`
	ChatModel  string `mapstructure:"chat_model"`
	EmbedModel string `mapstructure:"embed_model"`
}

type ServerConfig

type ServerConfig struct {
	Host   string `mapstructure:"host"`
	Port   int    `mapstructure:"port"`
	APIKey string `mapstructure:"api_key"`
}

Jump to

Keyboard shortcuts

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