config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const FileMode fs.FileMode = 0o600

FileMode is the permission of config.toml. The file can hold API keys in plaintext (like ~/.aws/credentials or ~/.netrc), so only the owner may read it. Environment variables (INODE_LLM_API_KEY, ...) avoid storing keys at all.

View Source
const FileName = "config.toml"

FileName is the config file inside the config directory.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the path to the inode config directory (~/.inode).

func LooseMode

func LooseMode(dir string) (mode fs.FileMode, ok bool)

LooseMode reports the permissions of <dir>/config.toml when group or other users can read or write it. ok is false when the file is private or absent.

func Set

func Set(dir, key string, value any) error

Set writes key = value into <dir>/config.toml, keeping the other keys, and leaves the file at FileMode. An existing file with looser permissions (as written by inode before v0.5.0) is tightened. The directory is created with mode 0700 if missing.

Types

type Config

type Config struct {
	LLM       LLMConfig       `mapstructure:"llm"`
	Embedding EmbeddingConfig `mapstructure:"embedding"`
	DB        DBConfig        `mapstructure:"db"`
	Defaults  DefaultsConfig  `mapstructure:"defaults"`
	Search    SearchConfig    `mapstructure:"search"`
	MCP       MCPConfig       `mapstructure:"mcp"`
	Log       LogConfig       `mapstructure:"log"`
}

func Load

func Load() (*Config, error)

Load reads config from (in priority order):

  1. CLI flags (handled by cobra, passed in via overrides)
  2. Environment variables (INODE_* prefix)
  3. .env file (development only — loaded if present)
  4. ~/.inode/config.toml
  5. Hardcoded defaults

type DBConfig

type DBConfig struct {
	// Backend selects the storage engine: "sqlite" (default) or "postgres".
	Backend string `mapstructure:"backend"`
	// Path is the SQLite database file. Used only when Backend = sqlite.
	Path string `mapstructure:"path"`
	// DSN is the Postgres connection string (e.g. postgres://user:pass@host:5432/db?sslmode=disable).
	// Used only when Backend = postgres.
	DSN string `mapstructure:"dsn"`
}

type DefaultsConfig

type DefaultsConfig struct {
	Sensitive bool `mapstructure:"sensitive"`
}

type EmbeddingConfig

type EmbeddingConfig struct {
	Backend   string `mapstructure:"backend"`
	Model     string `mapstructure:"model"`
	APIKey    string `mapstructure:"api_key"`
	BaseURL   string `mapstructure:"base_url"`
	Dimension int    `mapstructure:"dimension"`
}

type LLMConfig

type LLMConfig struct {
	Backend string `mapstructure:"backend"`
	Model   string `mapstructure:"model"`
	APIKey  string `mapstructure:"api_key"`
	BaseURL string `mapstructure:"base_url"`
}

type LogConfig

type LogConfig struct {
	Level string `mapstructure:"level"`
}

type MCPConfig

type MCPConfig struct {
	// RevealSensitive, when true, lets the MCP server include plaintext
	// content of notes marked sensitive (search_notes will surface them
	// to the LLM, get_note will return unmasked content). Default false:
	// sensitive notes are excluded from search candidates and masked in
	// get_note responses.
	RevealSensitive bool `mapstructure:"reveal_sensitive"`
}

MCPConfig tunes the `inode mcp` Model Context Protocol server.

type SearchConfig

type SearchConfig struct {
	// MaxDistance drops notes whose L2 distance exceeds this value (0 = use built-in default, <0 = disable).
	MaxDistance float32 `mapstructure:"max_distance"`
	// TopK is the number of nearest-neighbour candidates fetched before threshold filtering (0 = use built-in default).
	TopK int `mapstructure:"top_k"`
}

SearchConfig tunes the RAG retrieval pipeline.

Jump to

Keyboard shortcuts

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