config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration management using Viper.

Loads and validates configuration from YAML files with support for multiple config locations and default values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() string

ConfigPath returns the path to the configuration directory

func DatabasePath

func DatabasePath() string

DatabasePath returns the default database path

Types

type Config

type Config struct {
	Profile  string         `mapstructure:"profile"`
	Database DatabaseConfig `mapstructure:"database"`
	Setup    SetupConfig    `mapstructure:"setup"`
	RestAPI  RestAPIConfig  `mapstructure:"rest_api"`
	Session  SessionConfig  `mapstructure:"session"`
	Logging  LoggingConfig  `mapstructure:"logging"`
	Ollama   OllamaConfig   `mapstructure:"ollama"`
	Qdrant   QdrantConfig   `mapstructure:"qdrant"`
}

Config represents the complete application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns configuration with verified default values

func Load

func Load() (*Config, error)

Load loads configuration from YAML file with fallback to defaults Searches in multiple locations: 1. ./config.yaml (current directory) 2. ~/.mycelicmemory/config.yaml (user home) 3. /etc/mycelicmemory/config.yaml (system-wide)

func (*Config) EnsureConfigDir

func (c *Config) EnsureConfigDir() error

EnsureConfigDir creates the configuration directory if it doesn't exist

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type DatabaseConfig

type DatabaseConfig struct {
	Path           string        `mapstructure:"path"`
	BackupInterval time.Duration `mapstructure:"backup_interval"`
	MaxBackups     int           `mapstructure:"max_backups"`
	AutoMigrate    bool          `mapstructure:"auto_migrate"`
}

DatabaseConfig holds database configuration Verified from config.yaml

type LoggingConfig

type LoggingConfig struct {
	Level  string `mapstructure:"level"`  // debug, info, warn, error
	Format string `mapstructure:"format"` // console, json
}

LoggingConfig holds logging configuration

type OllamaConfig

type OllamaConfig struct {
	Enabled        bool   `mapstructure:"enabled"`
	AutoDetect     bool   `mapstructure:"auto_detect"`
	BaseURL        string `mapstructure:"base_url"`
	EmbeddingModel string `mapstructure:"embedding_model"` // nomic-embed-text
	ChatModel      string `mapstructure:"chat_model"`      // qwen2.5:3b
}

OllamaConfig holds Ollama AI service configuration Verified models: nomic-embed-text (768-dim), qwen2.5:3b

type QdrantConfig

type QdrantConfig struct {
	Enabled    bool   `mapstructure:"enabled"`
	AutoDetect bool   `mapstructure:"auto_detect"`
	URL        string `mapstructure:"url"`
}

QdrantConfig holds Qdrant vector database configuration Verified: localhost:6333, HNSW (m=16, ef_construct=100)

type RestAPIConfig

type RestAPIConfig struct {
	Enabled  bool   `mapstructure:"enabled"`
	AutoPort bool   `mapstructure:"auto_port"`
	Port     int    `mapstructure:"port"`
	Host     string `mapstructure:"host"`
	CORS     bool   `mapstructure:"cors"`
}

RestAPIConfig holds REST API server configuration Verified behavior: auto_port enables automatic port selection

type SessionConfig

type SessionConfig struct {
	AutoGenerate bool   `mapstructure:"auto_generate"`
	Strategy     string `mapstructure:"strategy"`  // "git-directory", "manual", or "hash"
	ManualID     string `mapstructure:"manual_id"` // Used when strategy is "manual"
}

SessionConfig holds session management configuration Verified strategies: "git-directory", "manual", or "hash"

type SetupConfig

type SetupConfig struct {
	FirstRun    bool `mapstructure:"first_run"`
	WizardShown bool `mapstructure:"wizard_shown"`
}

SetupConfig holds setup wizard configuration

Jump to

Keyboard shortcuts

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