config

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDataDir is the default directory name for vecgrep data
	DefaultDataDir = ".vecgrep"
	// DefaultDBFile is the default database filename
	DefaultDBFile = "vecgrep.db"
	// DefaultConfigFile is the default config filename
	DefaultConfigFile = "config.yaml"
)

Variables

This section is empty.

Functions

func GetProjectRoot

func GetProjectRoot() (string, error)

GetProjectRoot finds the project root by looking for .vecgrep directory

Types

type Config

type Config struct {
	// DataDir is the directory where vecgrep stores its data
	DataDir string `mapstructure:"data_dir"`
	// DBPath is the path to the SQLite database file
	DBPath string `mapstructure:"db_path"`

	// Embedding configuration
	Embedding EmbeddingConfig `mapstructure:"embedding"`

	// Indexing configuration
	Indexing IndexingConfig `mapstructure:"indexing"`

	// Server configuration
	Server ServerConfig `mapstructure:"server"`
}

Config holds the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

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

Load loads configuration from file, environment, and flags

func (*Config) EnsureDataDir

func (c *Config) EnsureDataDir() error

EnsureDataDir creates the data directory if it doesn't exist

func (*Config) WriteDefaultConfig

func (c *Config) WriteDefaultConfig() error

WriteDefaultConfig writes the default config file to the data directory

type EmbeddingConfig

type EmbeddingConfig struct {
	// Provider is the embedding provider: "ollama", "openai", "local"
	Provider string `mapstructure:"provider"`
	// Model is the embedding model name
	Model string `mapstructure:"model"`
	// OllamaURL is the Ollama API URL
	OllamaURL string `mapstructure:"ollama_url"`
	// Dimensions is the embedding vector dimensions
	Dimensions int `mapstructure:"dimensions"`
}

EmbeddingConfig holds embedding provider settings

type IndexingConfig

type IndexingConfig struct {
	// ChunkSize is the target chunk size in tokens
	ChunkSize int `mapstructure:"chunk_size"`
	// ChunkOverlap is the overlap between chunks in tokens
	ChunkOverlap int `mapstructure:"chunk_overlap"`
	// IgnorePatterns are glob patterns to ignore during indexing
	IgnorePatterns []string `mapstructure:"ignore_patterns"`
	// MaxFileSize is the maximum file size to index in bytes
	MaxFileSize int64 `mapstructure:"max_file_size"`
}

IndexingConfig holds indexing settings

type ServerConfig

type ServerConfig struct {
	// Host is the server bind address
	Host string `mapstructure:"host"`
	// Port is the server port
	Port int `mapstructure:"port"`
	// MCPEnabled enables the MCP server
	MCPEnabled bool `mapstructure:"mcp_enabled"`
}

ServerConfig holds server settings

Jump to

Keyboard shortcuts

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