v0.7.0

Configuration

Last updated


This page covers where ToriiDB reads settings from: the data directory argument and the environment variables.

Configuration Surfaces


SurfaceHow it is setRequired
Data directorydir argument to store.New or daemon.NewYes
OpenAI API keyapiKey argument, OPENAI_API_KEY, or OS keychainOnly for vector operations
Embedding dimensionTORIIDB_EMBED_DIMNo

There is no config file. The Go code never loads .env; the repository Makefile does include .env + export for its own targets.

Data Directory


  1. torii, err := store.New("/var/lib/myapp/toriidb")
  2. d, err := daemon.New("/var/lib/myapp/toriidb")

  • An empty path returns an error; the directory is created when missing.
  • db_0 through db_15 subdirectories and their files are created lazily on first write.
  • For daemon.New, the directory is resolved to an absolute, symlink-free path, and that path alone determines the socket. ./data, /abs/data/, and a symlink to it all share one daemon.

The process needs permission to create files, fsync them, rename them, and fsync the directory.

Environment Variables


VariableDefaultEffect
OPENAI_API_KEYnoneEnables embeddings (see lookup order above)
TORIIDB_EMBED_DIM256Requested embedding dimension; values <= 0 fall back to 256

The embedding dimension is part of the cache key and must match the returned vector length. Changing it on an existing dataset leaves old vectors with a different length, and search skips them.

中文